liding
昨天 8d24d963f8b82163685c34b816998a904f08234d
feat: 新聚-下单到检验
已修改12个文件
634 ■■■■ 文件已修改
package.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/cnas/process/method/standardMethod.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/standardTree.js 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/process/method/standardMethod/index.vue 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/components/InspectionWord.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/inspection.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionView/index.vue 228 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/productOrder/components/addOrder.vue 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/productOrder/components/addView.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/standard/standardLibrary/index.vue 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/workers/InspectionWorker.worker.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -48,14 +48,16 @@
    "echarts": "5.4.0",
    "element-resize-detector": "^1.2.4",
    "element-ui": "2.15.14",
    "fast-png": "^5.0.0",
    "file-saver": "2.0.5",
    "fuse.js": "6.4.3",
    "highlight.js": "9.18.5",
    "html2canvas": "^1.4.1",
    "iobuffer": "^5.0.0",
    "js-beautify": "1.13.0",
    "js-cookie": "3.0.1",
    "jsencrypt": "3.0.0-rc.1",
    "jspdf": "^3.0.0",
    "jspdf": "^2.5.0",
    "mammoth": "^1.9.0",
    "moment": "^2.30.1",
    "nprogress": "0.2.0",
src/api/cnas/process/method/standardMethod.js
@@ -46,3 +46,25 @@
  });
}
export function selectIndustryOptions() {
  return request({ url: '/standardMethod/selectIndustryOptions', method: 'get' })
}
export function selectAttachments(query) {
  return request({ url: '/standardMethod/selectAttachments', method: 'get', params: query })
}
export function uploadAttachment(data, standardMethodId) {
  return request({
    url: '/standardMethod/uploadAttachment',
    method: 'post',
    params: { standardMethodId },
    data,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}
export function deleteAttachment(query) {
  return request({ url: '/standardMethod/deleteAttachment', method: 'delete', params: query })
}
src/utils/standardTree.js
@@ -36,7 +36,10 @@
  let cur = node;
  while (cur && cur.parent) {
    if (isLeaf(cur.data)) {
      tokens.push(cur.label, leafMarker);
      const leafValue = cur.data && cur.data.standardMethodId
        ? (cur.data.value || cur.label)
        : cur.label;
      tokens.push(leafValue, leafMarker);
    } else {
      tokens.push(cur.label);
    }
@@ -75,6 +78,14 @@
// 去掉路径末段,用于「当前是叶子但查不到标准」时回退到父级查询
export function dropLastLabel(path) {
  if (!path) return '';
  const idx = path.lastIndexOf(' - ');
  return idx === -1 ? '' : path.slice(0, idx);
  const tokens = path.split(' - ');
  if (tokens.length <= 1) return '';
  // 叶子路径格式为“行业 - null - 标准”或“行业 -  - 标准”。
  // 去掉标准名后还要去掉仅用于标识叶子的占位段,父路径才是真实的行业路径。
  tokens.pop();
  const marker = tokens[tokens.length - 1];
  if (marker === '' || marker === 'null') {
    tokens.pop();
  }
  return tokens.join(' - ');
}
src/views/CNAS/process/method/standardMethod/index.vue
@@ -34,16 +34,14 @@
    <!-- 新增/编辑 -->
    <el-dialog :title="title" :visible.sync="addDlog" width="500px">
      <el-form :model="addForm" ref="addForm" :rules="addRules" label-position="right" label-width="120px">
        <el-form-item label="领域" prop="field">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.field"></el-input>
        <el-form-item label="行业" prop="industryIds">
          <el-select v-model="addForm.industryIds" multiple filterable clearable collapse-tags placeholder="请选择行业" style="width: 100%">
            <el-option v-for="item in industryOptions" :key="item.id" :label="item.laboratoryName" :value="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="标准编号" prop="code">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.code">
          </el-input>
        </el-form-item>
        <el-form-item label="检验对象" prop="structureTestObjectId">
          <el-cascader size="small" :options="tandardTree" v-model="addForm.structureTestObjectId" collapse-tags
            :props="{ multiple: true, checkStrictly: true }" clearable style="width: 100%"></el-cascader>
        </el-form-item>
        <el-form-item label="标准描述" prop="name">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.name">
@@ -75,28 +73,48 @@
            <el-option label="是" :value="1"> </el-option>
          </el-select>
        </el-form-item>
        <el-form-item v-if="title === '新增'" label="附件">
          <el-upload ref="addUpload" action="#" :auto-upload="false" multiple :file-list="pendingFiles"
            :on-change="pendingFileChange" :on-remove="pendingFileRemove" :before-upload="beforeFileUpload"
            accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar">
            <el-button size="small" type="primary">选择附件</el-button><div slot="tip" class="el-upload__tip">支持多个附件,单个不超过10MB</div>
          </el-upload>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDlog = false">取 消</el-button>
        <el-button :loading="addLoading" type="primary" @click="submitProduct('addForm')">确 认</el-button>
      </span>
    </el-dialog>
    <el-dialog title="标准附件" :visible.sync="attachmentDialog" width="760px">
      <el-upload v-if="currentMethod.id" :action="attachmentAction" :headers="uploadHeader" multiple :show-file-list="false"
        :before-upload="beforeFileUpload" :on-success="attachmentUploadSuccess"
        accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar">
        <el-button size="small" type="primary">上传附件</el-button>
      </el-upload>
      <el-table :data="attachmentList" border size="small" style="margin-top:12px">
        <el-table-column label="文件名称" prop="fileName" min-width="280" />
        <el-table-column label="上传时间" prop="createTime" width="170" />
        <el-table-column label="操作" width="180"><template slot-scope="scope"><el-button type="text" @click="previewAttachment(scope.row)">预览</el-button><el-button type="text" @click="downloadAttachment(scope.row)">下载</el-button><el-button type="text" style="color:#f56c6c" @click="removeAttachment(scope.row)">删除</el-button></template></el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog title="预览附件" :visible.sync="previewDialog" fullscreen><file-preview v-if="previewDialog" :current-file="currentAttachment" :file-url="previewUrl" /></el-dialog>
  </div>
</template>
<script>
import limsTable from "@/components/Table/lims-table.vue";
import filePreview from "@/components/Preview/filePreview.vue";
import {
  selectStandardMethodList,
  getStandardTree2,
  delStandardMethod,
  addStandardMethod,
  upStandardMethod,
  upStandardMethod, selectIndustryOptions, selectAttachments, uploadAttachment, deleteAttachment,
} from "@/api/cnas/process/method/standardMethod";
export default {
  name: 'StandardMethod',
  components: {
    limsTable,
    limsTable, filePreview,
  },
  data() {
    return {
@@ -106,9 +124,8 @@
      queryParams: {},
      tableData: [],
      column: [
        { label: "领域", prop: "field", width: "100px" },
        { label: "行业", prop: "industryNames", width: "140px" },
        { label: "标准编号", prop: "code", width: "100px" },
        { label: "检验对象", prop: "structureTestObjectId", width: "140px" },
        { label: "标准描述", prop: "name", width: "100px" },
        { label: "标准描述EN", prop: "nameEn", width: "100px" },
        { label: "备注", prop: "remark" },
@@ -168,6 +185,15 @@
              },
            },
            {
              name: "上传附件", type: "text", clickFun: (row) => this.openAttachments(row),
            },
            {
              name: "下载附件", type: "text", clickFun: (row) => this.downloadAttachments(row),
            },
            {
              name: "预览附件", type: "text", clickFun: (row) => this.previewAttachments(row),
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
@@ -187,7 +213,9 @@
      addDlog: false,
      addLoading: false,
      qualificationList: [],
      tandardTree: [],
      industryOptions: [],
      pendingFiles: [], attachmentDialog: false, attachmentList: [], currentMethod: {},
      previewDialog: false, currentAttachment: {}, previewUrl: '',
      addRules: {
        code: [{ required: true, message: "请输入标准编号", trigger: "blur" }],
        name: [{ required: true, message: "请输入标准描述", trigger: "blur" }],
@@ -202,7 +230,7 @@
  },
  mounted() {
    this.getQualificationList();
    this.selectTestObjectByName();
    this.loadIndustryOptions();
    this.getList();
  },
  methods: {
@@ -230,26 +258,25 @@
    refreshTable() {
      this.page.current = 1;
      this.getList();
      this.selectTestObjectByName();
      this.loadIndustryOptions();
    },
    refresh() {
      this.selectTestObjectByName();
      this.loadIndustryOptions();
      this.page.current = 1;
      this.queryParams = {};
      this.getList();
    },
    openAdd() {
      this.title = "新增";
      this.addForm = {};
      this.addForm = { industryIds: [], isProduct: 1, isUse: 1 };
      this.pendingFiles = [];
      this.addDlog = true;
    },
    openEdit(row) {
      this.title = "编辑";
      this.addDlog = true;
      this.addForm = this.HaveJson(row)
      this.addForm.structureTestObjectId = JSON.parse(
        this.addForm.structureTestObjectId
      );
      this.addForm.industryIds = this.addForm.industryIds || [];
    },
    getQualificationList() {
      this.getDicts("cnas_method_qualification").then((response) => {
@@ -262,40 +289,24 @@
        this.qualificationList = arr;
      });
    },
    selectTestObjectByName() {
      getStandardTree2().then((res) => {
        res.data.forEach((a) => {
          this.cascaderFieldData(a);
        });
        this.tandardTree = res.data;
      });
    },
    cascaderFieldData(val) {
      if (val.children === undefined) {
        return;
      } else if (val.children.length == 0) {
        delete val.children;
      } else {
        val.children.forEach((a) => {
          this.cascaderFieldData(a);
        });
      }
    },
    loadIndustryOptions() { selectIndustryOptions().then(res => { this.industryOptions = res.data || []; }); },
    submitProduct(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.addLoading = true;
          let addForm = JSON.parse(JSON.stringify(this.addForm));
          addForm.structureTestObjectId = JSON.stringify(
            addForm.structureTestObjectId
          );
          if (this.title == "新增") {
            addStandardMethod(addForm)
              .then((res) => {
                const id = res.data;
                if (!id) throw new Error('新增标准未返回主键ID');
                return Promise.all(this.pendingFiles.map(item => {
                  const formData = new FormData();
                  formData.append('file', item.raw);
                  return uploadAttachment(formData, id);
                }));
              }).then(() => {
                this.addLoading = false;
                if (res.code != 200) {
                  return;
                }
                this.$message.success("提交成功");
                this.getList();
                this.addDlog = false;
@@ -323,6 +334,31 @@
        }
      });
    },
    beforeFileUpload(file) { if (file.size > 10 * 1024 * 1024) { this.$message.error('上传文件不超过10MB'); return false; } return true; },
    pendingFileChange(file, files) { this.pendingFiles = files; },
    pendingFileRemove(file, files) { this.pendingFiles = files; },
    openAttachments(row) { this.currentMethod = row; this.attachmentDialog = true; this.loadAttachments(); },
    downloadAttachments(row) {
      selectAttachments({ standardMethodId: row.id }).then(res => {
        const attachments = res.data || [];
        if (!attachments.length) this.$message.warning('暂无附件');
        else if (attachments.length === 1) this.downloadAttachment(attachments[0]);
        else this.openAttachments(row);
      });
    },
    previewAttachments(row) {
      selectAttachments({ standardMethodId: row.id }).then(res => {
        const attachments = res.data || [];
        if (!attachments.length) this.$message.warning('暂无附件');
        else if (attachments.length === 1) this.previewAttachment(attachments[0]);
        else this.openAttachments(row);
      });
    },
    loadAttachments() { selectAttachments({ standardMethodId: this.currentMethod.id }).then(res => { this.attachmentList = res.data || []; }); },
    attachmentUploadSuccess(res) { if (res.code === 200) { this.$message.success('上传成功'); this.loadAttachments(); } },
    downloadAttachment(row) { this.$download.saveAs(row.fileUrl, row.fileName); },
    previewAttachment(row) { this.currentAttachment = row; this.previewUrl = /\.(jpg|jpeg|png|gif)$/i.test(row.fileUrl) ? this.javaApi + '/img/' + row.fileUrl : this.javaApi + '/word/' + row.fileUrl; this.previewDialog = true; },
    removeAttachment(row) { this.$confirm('是否删除该附件?', '提示', { type: 'warning' }).then(() => deleteAttachment({ id: row.id })).then(() => this.loadAttachments()); },
    // 删除
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
@@ -339,5 +375,6 @@
        .catch(() => { });
    },
  },
  computed: { attachmentAction() { return this.javaApi + '/standardMethod/uploadAttachment?standardMethodId=' + this.currentMethod.id; } },
};
</script>
src/views/business/inspectionTask/components/InspectionWord.vue
@@ -57,6 +57,16 @@
              </el-select>
            </el-form-item>
          </el-form>
          <el-form :inline="true" :model="currentOtherForm" class="form-inline template-panel__conclusion--divided"
            size="small" label-width="84px">
            <el-form-item label="检验结论:">
              <el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2"
                @change="m => subOtherForm(m, 'insResult')">
                <el-radio :label="1">合格</el-radio>
                <el-radio :label="0">不合格</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
        <!-- 常规检验原始记录 -->
        <div id="tableBox" v-loading="tableLoading" class="center-box">
@@ -458,7 +468,8 @@
        humidity: null,
        detectionTime: null,
        detectionPlace: null,
        deviceIds: []
        deviceIds: [],
        insResult: null
      }
    }
  },
@@ -504,7 +515,8 @@
            humidity: item.humidity != null ? item.humidity : null,
            detectionTime: item.detectionTime != null ? item.detectionTime : null,
            detectionPlace: item.detectionPlace != null ? item.detectionPlace : null,
            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : []
            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
            insResult: item.insResult != null ? item.insResult : null
          })
        })
        if (this.typeSource == '1') {
@@ -1347,8 +1359,9 @@
    },
    // 新聚直接绑定模板的单据,设备按模板选择
    isDirectTemplateOrder() {
      return this.sonLaboratory === '新聚' && this.currentSample &&
        (this.currentSample.insProduct || []).some(product => product.templateRowIndex != null)
      return this.sonLaboratory === '新聚' &&
        Array.isArray(this.insOrder.templateConditions) &&
        this.insOrder.templateConditions.length > 0
    },
    loadDeviceOptions() {
      search({ status: 0 }).then(res => {
@@ -1369,13 +1382,24 @@
    upInsReview(e) {
      if (e == 1) {
        // 通过
        const insResults = this.tableLists.map(
          item => (this.otherForm[item.templateId] || {}).insResult
        )
        const missingIndex = insResults.findIndex(result => result !== 0 && result !== 1)
        if (this.isDirectTemplateOrder() && missingIndex > -1) {
          this.$message.error(`请选择「${this.tableLists[missingIndex].templateName}」的检验结论`)
          return
        }
        this.reviewLoading = true;
        verifyPlan({
          orderId: this.orderId,
          type: 1,
          laboratory: this.sonLaboratory,
          tell: null,
          userId: this.checkUser
          userId: this.checkUser,
          insResult: this.isDirectTemplateOrder()
            ? (insResults.every(result => result === 1) ? 1 : 0)
            : this.insOrder.insResult
        }).then(res => {
          if (res.code === 200) {
            this.$message.success("操作成功")
@@ -1423,7 +1447,8 @@
          humidity: null,
          detectionTime: null,
          detectionPlace: null,
          deviceIds: []
          deviceIds: [],
          insResult: null
        })
      }
    },
@@ -1817,6 +1842,11 @@
  color: #606266;
}
.template-panel__conclusion--divided {
  border-top: 1px dashed #e4e7ed;
  padding-top: 12px;
}
.center {
  width: calc(100% - 40px);
  /* max-height: 580px; */
src/views/business/inspectionTask/inspection.vue
@@ -91,7 +91,7 @@
        </template>
        <template v-else>
          <el-descriptions-item label="委托编号">{{ insOrder.entrustCode }}</el-descriptions-item>
          <el-descriptions-item label="检测依据">{{ insOrder.sample || '-' }}</el-descriptions-item>
          <el-descriptions-item label="检测依据">{{ standardDisplayName(insOrder.sample) }}</el-descriptions-item>
          <el-descriptions-item label="样品名称">{{ insOrder.sampleView || '-' }}</el-descriptions-item>
          <el-descriptions-item label="样品编号">{{ currentSample.sampleCode }}</el-descriptions-item>
          <el-descriptions-item label="样品数量">{{ insOrder.testQuantity }}</el-descriptions-item>
@@ -968,6 +968,11 @@
    this.stopWorker();
  },
  methods: {
    standardDisplayName(value) {
      if (!value) return '-';
      const separatorIndex = value.indexOf(' - ');
      return separatorIndex > -1 ? value.slice(0, separatorIndex) : value;
    },
    validateQuality(){
      let inboundLength = Number(this.calcInbondLength(this.ifsMaterialPropsForm.startMeterMark,this.ifsMaterialPropsForm.endMeterMark));
      let testQuantity = Number(this.insOrder.testQuantity);
@@ -1683,9 +1688,17 @@
          payload[type] = Number(m);
        }
      }
      write(payload).then((res) => {
        this.$message.success("保存成功");
      });
      const previousSave = this.saveQueue || Promise.resolve();
      this.saveQueue = previousSave
        .catch(() => undefined)
        .then(() => write(payload))
        .then(() => {
          this.$message.success("保存成功");
        })
        .catch((error) => {
          console.error("检验条件保存失败", error);
          this.$message.error("检验条件保存失败,请重试");
        });
    },
    exportTable(tableId) {
      // 获取table元素
@@ -2197,6 +2210,11 @@
    },
    // 对输入值进行格式校验
    handleInput(n) {
      // 直绑模板未配置检验值类型时按自由文本处理,允许录入外观等中文结果。
      const inspectionValueType = this.getInspectionValueType(n.i);
      if (inspectionValueType === undefined || inspectionValueType === null) {
        return;
      }
      try {
        const v = n.v.v;
        // 能力范围已废弃,检验值类型不再作为判断依据。整串只由算式字符组成时才规范化格式,
@@ -2362,6 +2380,24 @@
        return;
      }
      await this.waitForPendingSaves();
      try {
        await Promise.all(this.tableLists.map((template) => {
          const form = this.otherForm[template.templateId] || {};
          return write({
            id: this.insOrder.id,
            templateId: template.templateId,
            temperature: form.temperature == null ? null : form.temperature,
            humidity: form.humidity == null ? null : form.humidity,
            detectionTime: form.detectionTime || null,
            detectionPlace: form.detectionPlace || null,
            deviceIds: Array.isArray(form.deviceIds) ? [...form.deviceIds] : [],
          });
        }));
      } catch (error) {
        console.error("检验条件保存失败", error);
        this.$message.error("检验条件保存失败,请重试");
        return;
      }
      this.submitLoading = true;
      checkSubmitPlan({
        orderId: this.orderId,
@@ -2578,8 +2614,9 @@
      this.saveInsContext();
    },
    isDirectTemplateOrder() {
      return this.sonLaboratory === "新聚" && this.currentSample &&
        (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null);
      return this.sonLaboratory === "新聚" &&
        Array.isArray(this.insOrder.templateConditions) &&
        this.insOrder.templateConditions.length > 0;
    },
    loadDeviceOptions() {
      search({ status: 0 }).then((devices) => {
src/views/business/inspectionView/index.vue
@@ -1,22 +1,7 @@
<template>
  <div v-loading="loading" class="inspection" style="background-color: rgb(245, 247, 251);">
    <el-row class="title">
      <el-col :span="8" style="text-align: left">
        <el-form :inline="true" :model="otherForm" class="form-inline" label-width="50px"
                 style="text-align: right; padding-top: 0; display: inline">
          <el-form-item label="温度:" style="margin-bottom: 0">
            <el-input v-model="otherForm.temperature" :disabled="state > 1" placeholder="" size="small"
                      style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'temperature')"></el-input>
            <span style="margin-left: 4px">℃</span>
          </el-form-item>
          <el-form-item label="湿度:" style="margin-bottom: 0">
            <el-input v-model="otherForm.humidity" :disabled="state > 1" placeholder="" size="small"
                      style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'humidity')"></el-input>
            <span style="margin-left: 4px">%</span>
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="16" style="text-align: right">
      <el-col :span="24" style="text-align: right">
        <el-button size="small" type="primary" @click="refreshView">刷新</el-button>
        <el-button v-if="typeSource == 1" size="small" type="primary" @click="openPurchase">进货验证</el-button>
        <el-button v-if="state == 1 && typeSource == 1" size="small" type="primary"
@@ -73,12 +58,6 @@
          <el-input v-model="insOrder.remark" :disabled="state != 1" clearable placeholder="请输入" size="small"
                    @blur="subOtherForm(insOrder.remark, 'remark')"></el-input>
          <!-- <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> -->
        </el-form-item>
        <el-form-item label="检验结论:">
          <el-radio-group v-model="reviewInsResult" :disabled="state != 2">
            <el-radio :label="1">合格</el-radio>
            <el-radio :label="0">不合格</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
    </div>
@@ -150,6 +129,51 @@
                     @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "关闭编辑" : "编辑数采"
            }}</el-button>
        </div>
      </div>
      <!-- 当前检验模板的检测条件与检验结论 -->
      <div class="template-panel">
        <el-form v-if="showTemplateConditions" :inline="true" :model="currentOtherForm" class="form-inline"
                 size="small" label-width="84px">
          <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" label="温度:">
            <el-input v-model="currentOtherForm.temperature" :disabled="state > 1" size="small"
                      style="width: 90px" @change="m => subOtherForm(m, 'temperature')" />
            <span class="template-panel__unit">℃</span>
          </el-form-item>
          <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" label="湿度:">
            <el-input v-model="currentOtherForm.humidity" :disabled="state > 1" size="small"
                      style="width: 90px" @change="m => subOtherForm(m, 'humidity')" />
            <span class="template-panel__unit">%RH</span>
          </el-form-item>
          <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" label="检测时间:">
            <el-date-picker v-model="currentOtherForm.detectionTime" :disabled="state > 1" type="date"
                            value-format="yyyy-MM-dd" placeholder="请选择日期" size="small" style="width: 160px"
                            @change="m => subOtherForm(m, 'detectionTime')" />
          </el-form-item>
          <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" label="检测地点:">
            <el-input v-model="currentOtherForm.detectionPlace" :disabled="state > 1" clearable
                      placeholder="请输入检测地点" size="small" style="width: 200px"
                      @change="m => subOtherForm(m, 'detectionPlace')" />
          </el-form-item>
          <el-form-item v-if="isDirectTemplateOrder()" label="设备:">
            <el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable
                       placeholder="请选择设备" size="small" style="width: 360px"
                       @change="m => subOtherForm(m, 'deviceIds')">
              <el-option v-for="device in orderDeviceOptions" :key="device.id" :label="device.label"
                         :value="device.id" />
            </el-select>
          </el-form-item>
        </el-form>
        <el-form :inline="true" :model="currentOtherForm"
                 :class="['form-inline', { 'template-panel__conclusion--divided': showTemplateConditions }]"
                 size="small" label-width="84px">
          <el-form-item label="检验结论:">
            <el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2"
                            @change="m => subOtherForm(m, 'insResult')">
              <el-radio :label="1">合格</el-radio>
              <el-radio :label="0">不合格</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
      </div>
      <!-- 常规检验原始记录 -->
      <div id="nav" v-loading="tableLoading" class="center-box">
@@ -551,6 +575,7 @@
      comparisonList: [],
      excelMethodList: [],
      equipOptions: [],
      orderDeviceOptions: [],
      reviewLoading: false,
      reviewDia: false,
      noReason: "",
@@ -571,10 +596,8 @@
        inspectionItem: 1,
        inspectionItemSubclass: "20(常温)",
      },
      otherForm: {
        humidity: null,
        temperature: null,
      },
      // 检测条件与检验结论按模板 ID 分组
      otherForm: {},
      equipForm: {
        value0: null,
        code0: null,
@@ -724,8 +747,22 @@
    action() {
      return this.javaApi + "/insOrderPlan/uploadFile";
    },
    currentOtherForm() {
      return this.otherForm[this.currentTable] || {
        temperature: null,
        humidity: null,
        detectionTime: null,
        detectionPlace: null,
        deviceIds: [],
        insResult: null,
      };
    },
    showTemplateConditions() {
      return this.insOrder.ifsOrderType !== "02wg" || this.isDirectTemplateOrder();
    },
  },
  created() {
    this.saveQueue = Promise.resolve();
    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
      this.$route.query;
    this.sonLaboratory = sonLaboratory;
@@ -898,18 +935,26 @@
        this.sampleProduct = res.data.sampleProduct;
        this.currentSample = this.HaveJson(this.sampleProduct[0]);
        let insProduct = this.HaveJson(this.currentSample.insProduct);
        // 温度、湿度赋值
        this.otherForm = {
          temperature: this.insOrder.temperature
            ? this.insOrder.temperature
            : null,
          humidity: this.insOrder.humidity ? this.insOrder.humidity : null,
        };
        // 按模板回显检测条件与检验结论
        this.otherForm = {};
        (this.insOrder.templateConditions || []).forEach((item) => {
          this.$set(this.otherForm, item.templateId, {
            temperature: item.temperature != null ? item.temperature : null,
            humidity: item.humidity != null ? item.humidity : null,
            detectionTime: item.detectionTime != null ? item.detectionTime : null,
            detectionPlace: item.detectionPlace != null ? item.detectionPlace : null,
            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
            insResult: item.insResult != null ? item.insResult : null,
          });
        });
        if (this.typeSource == "1") {
          this.getRawMaterialTag(this.currentSample.id); // 原材料的检验任务查询批数
          this.rawMaterialTag = "1";
        }
        this.getEquipOptions(1);
        if (this.sonLaboratory === "新聚") {
          this.loadDeviceOptions();
        }
        // 获取当前样品的检验项
        let list = await this.getCurrentProduct(this.currentSample.id, 0);
        this.currentSample.insProduct = this.HaveJson(list);
@@ -920,6 +965,7 @@
          this.currentSample["index"] = 1;
        let bushing = this.currentSample.bushing;
        this.getTableLists(); //处理模板列表信息
        this.tableLists.forEach((item) => this.ensureOtherForm(item.templateId));
        this.currentKey = 1;
        this.getCableTag(this.currentSample.id); // 查询是否有要多次检验的电缆配置
@@ -1406,12 +1452,33 @@
        this.worker0 = null;
      }
    },
    // 保存湿度、温度数据
    ensureOtherForm(templateId) {
      if (templateId == null || this.otherForm[templateId]) return;
      this.$set(this.otherForm, templateId, {
        temperature: null,
        humidity: null,
        detectionTime: null,
        detectionPlace: null,
        deviceIds: [],
        insResult: null,
      });
    },
    // 保存当前模板的检测条件;备注仍然是订单级字段
    subOtherForm(m, type) {
      write({
        [type]: type === "remark" ? m : Number(m),
        id: this.insOrder.id,
      }).then((res) => {
      const payload = { id: this.insOrder.id };
      if (type === "remark") {
        payload.remark = m;
      } else {
        payload.templateId = this.currentTable;
        if (type === "deviceIds") {
          payload.deviceIds = Array.isArray(m) ? [...m] : [];
        } else if (type === "detectionTime" || type === "detectionPlace") {
          payload[type] = m === "" || m == null ? null : m;
        } else {
          payload[type] = Number(m);
        }
      }
      write(payload).then((res) => {
        this.$message.success("保存成功");
      });
    },
@@ -1922,6 +1989,11 @@
    },
    // 对输入值进行格式校验
    handleInput(n) {
      // 直绑模板未配置检验值类型时按自由文本处理,允许录入外观等中文结果。
      const inspectionValueType = this.getInspectionValueType(n.i);
      if (inspectionValueType === undefined || inspectionValueType === null) {
        return;
      }
      try {
        n.v.v = n.v.v.replace(/[^\d.^e>>≥≤<<断裂脆化\-/+]/g, "");
        n.v.v = n.v.v.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
@@ -1970,7 +2042,18 @@
    upInsReview(e) {
      if (e == 1) {
        // 通过
        if (this.reviewInsResult !== 0 && this.reviewInsResult !== 1) {
        let finalInsResult = this.reviewInsResult;
        if (this.isDirectTemplateOrder()) {
          const insResults = this.tableLists.map(
            item => (this.otherForm[item.templateId] || {}).insResult
          );
          const missingIndex = insResults.findIndex(result => result !== 0 && result !== 1);
          if (missingIndex > -1) {
            this.$message.error(`请选择「${this.tableLists[missingIndex].templateName}」的检验结论`);
            return;
          }
          finalInsResult = insResults.every(result => result === 1) ? 1 : 0;
        } else if (finalInsResult !== 0 && finalInsResult !== 1) {
          this.$message.error("请选择检验结论");
          return;
        }
@@ -1981,7 +2064,7 @@
          laboratory: this.sonLaboratory,
          tell: null,
          userId: this.checkUser,
          insResult: this.reviewInsResult,
          insResult: finalInsResult,
        }).then((res) => {
          if (res.code === 200) {
            this.$message.success("操作成功");
@@ -2034,12 +2117,21 @@
        this.$message.error("请指定复核人员");
        return;
      }
      if (!this.otherForm.humidity) {
        this.$message.error("请输入湿度");
        return;
      }
      if (!this.otherForm.temperature) {
        this.$message.error("请输入温度");
      const missing = [];
      this.tableLists.forEach((item) => {
        const form = this.otherForm[item.templateId] || {};
        if (this.insOrder.ifsOrderType !== "02wg") {
          if (!form.temperature) missing.push(`请填写「${item.templateName}」的温度`);
          if (!form.humidity) missing.push(`请填写「${item.templateName}」的湿度`);
          if (!form.detectionTime) missing.push(`请选择「${item.templateName}」的检测时间`);
          if (!form.detectionPlace) missing.push(`请填写「${item.templateName}」的检测地点`);
        }
        if (this.isDirectTemplateOrder() && (!form.deviceIds || form.deviceIds.length === 0)) {
          missing.push(`请选择「${item.templateName}」的设备`);
        }
      });
      if (missing.length > 0) {
        this.$message.error(missing[0]);
        return;
      }
      await this.waitForPendingSaves();
@@ -2257,8 +2349,19 @@
      this.saveInsContext();
    },
    isDirectTemplateOrder() {
      return this.sonLaboratory === "新聚" && this.currentSample &&
        (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null);
      return this.sonLaboratory === "新聚" &&
        Array.isArray(this.insOrder.templateConditions) &&
        this.insOrder.templateConditions.length > 0;
    },
    loadDeviceOptions() {
      search({ status: 0 }).then((res) => {
        this.orderDeviceOptions = (res.data || []).map((device) => ({
          id: device.id,
          label: `${device.deviceName}--${device.managementNumber}`,
        }));
      }).catch((error) => {
        console.error(error);
      });
    },
    async waitForPendingSaves() {
      const targetRevision = this.calculationRevision;
@@ -2448,6 +2551,35 @@
  text-align: left;
}
.template-panel {
  background-color: #f8f9fb;
  border: 1px solid #ebeef5;
  border-radius: 3px;
  padding: 16px 16px 4px;
  margin-bottom: 12px;
  text-align: left;
}
.template-panel>>>.el-form-item {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
}
.template-panel>>>.el-form-item__label {
  flex: none;
}
.template-panel__unit {
  margin-left: 4px;
  color: #606266;
}
.template-panel__conclusion--divided {
  border-top: 1px dashed #e4e7ed;
  padding-top: 12px;
}
.center {
  width: 100%;
  /* max-height: 580px; */
src/views/business/productOrder/components/addOrder.vue
@@ -3,14 +3,14 @@
    <div v-show="!cableConfigShow&&!auxiliaryShow" class="order-header">
      <span class="order-header__title">委托单信息</span>
      <div class="order-header__actions">
<!--        <el-cascader-->
<!--          v-model="addObj.quarterItemId"-->
<!--          :disabled="active>1"-->
<!--          :options="quarterItemOptions"-->
<!--          placeholder="请选择季度"-->
<!--          size="small"-->
<!--          class="order-header__quarter"-->
<!--          @focus="getQuarterOnOrderList"></el-cascader>-->
        <el-cascader
          v-model="addObj.quarterItemId"
          :disabled="active>1"
          :options="quarterItemOptions"
          placeholder="请选择季度"
          size="small"
          class="order-header__quarter"
          @focus="getQuarterOnOrderList"></el-cascader>
        <el-select v-show="active==1" v-model="template" placeholder="下单模板" size="small"
                   class="order-header__template"
                   @change="selectInsOrderTemplateById">
@@ -38,9 +38,9 @@
    </div>
    <div v-show="!cableConfigShow&&!auxiliaryShow" class="order-body">
      <el-card shadow="never" class="order-card">
        <el-form ref="newJuOrder" :model="addObj" size="small" label-width="108px" label-position="right">
        <el-form ref="newJuOrder" class="newju-order-form" :model="addObj" size="small" label-width="108px" label-position="right">
          <el-row :gutter="16">
            <el-col :span="6"><el-form-item label="检测依据"><el-input v-model="addObj.sample" disabled size="small"><template slot="append"><el-button :disabled="active>1" icon="el-icon-search" @click="selectStandardTree = true" /></template></el-input></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="检测依据"><el-input v-model="addObj.sample" disabled size="small"><template slot="append"><el-button :disabled="active>1" icon="el-icon-search" size="small" @click="selectStandardTree = true" /></template></el-input></el-form-item></el-col>
            <el-col :span="18">
              <el-form-item label="原始记录模板">
                <div v-loading="templateBindingLoading" class="template-tag-list">
@@ -53,7 +53,7 @@
          <el-row :gutter="16">
            <el-col :span="6"><el-form-item label="样品名称"><el-input v-model="addObj.sampleView" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="生产单位"><el-input v-model="addObj.production" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="委托单位"><el-input v-model="addObj.company" disabled size="small"><template slot="append"><el-button :disabled="active>1" icon="el-icon-search" @click="openCompanyList" /></template></el-input></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="委托单位"><el-input v-model="addObj.company" disabled size="small"><template slot="append"><el-button :disabled="active>1" icon="el-icon-search" size="small" @click="openCompanyList" /></template></el-input></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="检验类别"><el-select v-model="addObj.orderType" :disabled="active>1" size="small"><el-option v-for="item in dict.type.check_type1" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item></el-col>
          </el-row>
          <el-row :gutter="16">
@@ -957,7 +957,7 @@
          };
          this.addObj.type = String(this.addObj.type)
          const samples = this.HaveJson(res.data.sampleProduct)
          this.sampleCode = samples.length ? samples[0].sampleCode || '' : ''
          this.sampleCode = res.data.sampleCode || (samples.length ? samples[0].sampleCode || '' : '')
          this.boundTemplateList = this.sortTemplateList(res.data.templateList)
          const loadSamples = this.canSelectProduct
            ? Promise.all(samples.map(sample => this.loadSelectableProducts(sample)))
@@ -2392,6 +2392,23 @@
  flex-wrap: wrap;
  gap: 8px;
}
.newju-order-form >>> .el-form-item {
  display: flex;
  margin-right: 0;
}
.newju-order-form >>> .el-form-item__label {
  flex: 0 0 108px;
}
.newju-order-form >>> .el-form-item__content {
  flex: 1;
  min-width: 0;
  margin-left: 0 !important;
}
.newju-order-form >>> .el-input,
.newju-order-form >>> .el-select,
.newju-order-form >>> .el-date-editor {
  width: 100%;
}
.empty-template-text {
  color: #909399;
}
src/views/business/productOrder/components/addView.vue
@@ -39,7 +39,7 @@
    <div v-show="!cableConfigShow&&!auxiliaryShow" style="margin-top: 10px">
      <div class="search">
        <el-descriptions class="order-detail" :column="4" border>
          <el-descriptions-item label="检测依据">{{ addObj.sample || '-' }}</el-descriptions-item>
          <el-descriptions-item label="检测依据">{{ standardDisplayName(addObj.sample) }}</el-descriptions-item>
          <el-descriptions-item label="样品名称">{{ addObj.sampleView || '-' }}</el-descriptions-item>
          <el-descriptions-item label="生产单位">{{ addObj.production || '-' }}</el-descriptions-item>
          <el-descriptions-item label="委托单位">{{ addObj.company || '-' }}</el-descriptions-item>
@@ -60,6 +60,38 @@
          </el-descriptions-item>
          <el-descriptions-item label="备注" :span="4">{{ addObj.remark || '-' }}</el-descriptions-item>
        </el-descriptions>
        <el-form class="newju-order-form" :model="addObj" label-width="108px" label-position="right">
          <el-row>
            <el-col :span="6"><el-form-item label="产品名称"><el-input v-model="addObj.sample" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="生产单位"><el-input v-model="addObj.production" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="委托单位"><el-input v-model="addObj.company" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="检验类别"><el-select v-model="addObj.orderType" disabled size="small"><el-option v-for="item in dict.type.check_type1" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item></el-col>
          </el-row>
          <el-row v-if="boundTemplateList.length">
            <el-col :span="24">
              <el-form-item label="原始记录模板">
                <div class="template-tag-list">
                  <el-tag v-for="item in boundTemplateList" :key="item.templateId" size="small" effect="plain">{{ item.name }}</el-tag>
                </div>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6"><el-form-item label="样品数量"><el-input v-model="addObj.testQuantity" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="样品编号"><el-input v-model="sampleCode" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="样品外观"><el-input v-model="addObj.sampleStatus" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="送样人"><el-input v-model="addObj.prepareUser" disabled size="small" /></el-form-item></el-col>
          </el-row>
          <el-row>
            <el-col :span="6"><el-form-item label="生产日期"><el-date-picker v-model="addObj.productionDate" type="date" value-format="yyyy-MM-dd" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="生产批号"><el-input v-model="addObj.productionBatch" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="送样日期"><el-date-picker v-model="addObj.sampleDate" type="date" value-format="yyyy-MM-dd" disabled size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="联系方式"><el-input v-model="addObj.phone" disabled size="small" /></el-form-item></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"><el-form-item label="备注"><el-input v-model="addObj.remark" disabled size="small" style="width: 520px" /></el-form-item></el-col>
          </el-row>
        </el-form>
        <el-form v-show="false" ref="addObj" :inline="true" :model="addObj" :rules="addObjRules" label-width="108px" label-position="right">
          <el-row>
            <el-col :span="6">
@@ -877,6 +909,11 @@
    this.getInfo();
  },
  methods: {
    standardDisplayName(value) {
      if (!value) return '-';
      const separatorIndex = value.indexOf(' - ');
      return separatorIndex > -1 ? value.slice(0, separatorIndex) : value;
    },
    getInfo() {
      this.selectStandardTreeList()
      this.getAuthorizedPerson();
@@ -893,7 +930,7 @@
          };
          this.addObj.type = String(this.addObj.type)
          this.sampleList = this.HaveJson(res.data.sampleProduct);
          this.sampleCode = this.sampleList.length ? this.sampleList[0].sampleCode : ''
          this.sampleCode = res.data.sampleCode || (this.sampleList.length ? this.sampleList[0].sampleCode : '')
          this.boundTemplateList = (res.data.templateList || []).slice().sort((a, b) => (a.sort || 0) - (b.sort || 0))
          this.specialStandardMethod = this.sampleList[0].specialStandardMethod
          this.getProNum()
@@ -2270,4 +2307,21 @@
.order-detail__empty {
  color: #c0c4cc;
}
.newju-order-form >>> .el-form-item {
  display: flex;
  margin-right: 0;
}
.newju-order-form >>> .el-form-item__label {
  flex: 0 0 108px;
}
.newju-order-form >>> .el-form-item__content {
  flex: 1;
  min-width: 0;
  margin-left: 0 !important;
}
.newju-order-form >>> .el-input,
.newju-order-form >>> .el-select,
.newju-order-form >>> .el-date-editor {
  width: 100%;
}
</style>
src/views/standard/standardLibrary/index.vue
@@ -8,12 +8,11 @@
            <div class="head-container addButton">
              <el-input v-model="search" clearable placeholder="输入关键字进行搜索" size="small" style="margin-bottom: 5px"
                        suffix-icon="el-icon-search" @keydown.enter.native="searchFilter" @blur="searchFilter" @clear="searchFilter"></el-input>
              <el-button circle icon="el-icon-plus" size="mini" type="primary" @click="openAddDia"></el-button>
            </div>
            <div class="head-container">
              <el-tree ref="tree" v-loading="treeLoad" :data="list"
                       :default-expanded-keys="expandedKeys" :filter-node-method="filterNode"
                       :props="{ children: 'children', label: 'label' }" highlight-current node-key="label"
                       :props="{ children: 'children', label: 'label' }" highlight-current node-key="id"
                       style="
                        height: calc(100vh - 173px);
                        overflow-y: scroll;
@@ -31,22 +30,6 @@
                  }`"></i>
                {{ data.label }}
              </span>
                    </el-col>
                    <el-col v-if="
              checkPermi(['standard:standardLibrary:delStandardTree']) &&
              isLeaf(node.data)
            " :span="2" style="text-align: right">
                      <el-button size="mini" type="text" @click.stop="editTreeName(node)">
                        <i class="el-icon-edit"></i>
                      </el-button>
                    </el-col>
                    <el-col v-if="
              checkPermi(['standard:standardLibrary:delStandardTree']) &&
              isLeaf(node.data)
            " :span="2" style="text-align: right">
                      <el-button size="mini" type="text" @click.stop="remove(node, data)">
                        <i class="el-icon-delete"></i>
                      </el-button>
                    </el-col>
                  </el-row>
                </div>
@@ -585,7 +568,14 @@
    selectStandardTreeList() {
      this.treeLoad = true;
      selectStandardTreeList().then((res) => {
        this.list = res.data;
        this.list = (res.data || []).map(industry => ({
          ...industry,
          children: (industry.children || []).map(standard => ({
            ...standard,
            // 二级节点只展示标准编号;兼容尚未重启的旧后端返回格式。
            label: standard.standardCode || String(standard.label || '').split(' - ')[0],
          })),
        }));
        this.expandedKeys = [];
        this.list.forEach((a) => {
          this.expandedKeys.push(a.label);
src/workers/InspectionWorker.worker.js
@@ -176,6 +176,18 @@
}
/**
 * 获取纯单元格引用公式的坐标名,例如 =F4、=$F$4。
 * 纯引用应直接复制原值,避免把“外观”等中文文本送入数值计算。
 */
function getDirectReferenceName(f) {
  if (typeof f !== "string") {
    return null;
  }
  const matched = f.trim().match(/^=\s*\$?([A-Za-z]{1,3})\$?(\d{1,7})\s*$/);
  return matched ? `${matched[1].toUpperCase()}${matched[2]}` : null;
}
/**
 * 按检验项id取当前样品下的检验项信息,取不到时返回空对象,避免公式计算因缺项中断
 *
 * @param id 检验项id
@@ -277,7 +289,11 @@
        // 如果是函数方法,则执行此方法
        let comResult = ""; //初始化计算结果
        try {
          if (
          const directReferenceName = getDirectReferenceName(item.v.f);
          if (directReferenceName && Object.prototype.hasOwnProperty.call(comValue, directReferenceName)) {
            // =F4 这类公式既可能引用数字,也可能引用中文文本,直接保留源值。
            comResult = comValue[directReferenceName];
          } else if (
            getInspectionValueType(item.i) == 1 ||
            isNumericFormula(item.v.f)
          ) {
vue.config.js
@@ -37,7 +37,7 @@
      // detail: https://cli.vuejs.org/config/#devserver-proxy
      [process.env.VUE_APP_BASE_API]: {
        // target: `http://36.213.90.123:9015/lims`,
        target: `http://192.168.0.24:8001/lims`,
        target: `http://127.0.0.1:8001/lims`,
        changeOrigin: true,
        pathRewrite: {
          ["^" + process.env.VUE_APP_BASE_API]: "",