吴羡
3 天以前 d2eed0eb7c2f9537d5eaab7ccc3b6ab258959227
src/views/business/inspectionTask/inspection.vue
@@ -121,9 +121,6 @@
          </el-radio-group>
        </div>
        <div style="display: flex; align-items: center">
          <el-button v-if="state == 1" size="small" type="primary" @click="openAddUnpass">新增不合格复测</el-button>
          <el-button v-if="state == 1" size="small" type="primary" @click="unpassCheck">不合格复测</el-button>
          <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">查看不合格复测</el-button>
          <span v-if="cableTagList.length > 0">&nbsp;&nbsp;电缆配置:</span>
          <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="请选择" size="small"
            @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m)
@@ -180,9 +177,9 @@
            <span class="template-panel__unit">℃</span>
          </el-form-item>
          <el-form-item 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-date-picker>
            <el-date-picker v-model="currentOtherForm.detectionTimeRange" :disabled="state > 1" type="daterange"
              value-format="YYYY-MM-DD" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small" style="width: 260px"
              @change="(m) => subOtherForm(m, 'detectionTimeRange')"></el-date-picker>
          </el-form-item>
          <el-form-item label="检测地点:">
            <el-input v-model="currentOtherForm.detectionPlace" :disabled="state > 1" clearable placeholder="请输入检测地点"
@@ -190,7 +187,8 @@
          </el-form-item>
          <el-form-item label="设备:">
            <el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable
              size="small" placeholder="请选择设备" style="width: 360px"
              class="device-select" size="small" placeholder="请选择设备"
              style="width: 360px !important; min-width: 360px; flex: 0 0 360px"
              @change="(m) => subOtherForm(m, 'deviceIds')">
              <el-option v-for="device in orderDeviceOptions" :key="device.id" :label="device.label" :value="device.id" />
            </el-select>
@@ -399,7 +397,7 @@
        </div>
        <div class="search_input" style="width: 100%">
          <el-select v-model="verifyUser" clearable filterable placeholder="请选择" size="small" style="width: 100%">
            <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value">
            <el-option v-for="(item, i) in reviewerOptions" :key="i" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
@@ -492,6 +490,7 @@
<script>
// Vue3 没有 this.$createElement(下面用 h 造 VNode 当 $msgbox 的 message)
import { h } from 'vue'
import { readDetectionTimeRange, isCompleteDetectionTimeRange, toDetectionTimePayload } from '@/utils/detectionTimeRange'
import excelFunction from "@/utils/excelFountion";
import limsTable from "@/components/Table/lims-table.vue";
import UnPassDialog from "../unpass/components/unPassDialog.vue";
@@ -524,6 +523,7 @@
import { mapGetters } from "@/utils/store-compat";
import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue";
import {getDicts} from "@/api/system/dict/data";
import { parseInspectionValueAnnotation, formatInspectionValue } from "@/utils/inspectionValueFormat";
export default {
  name: 'Inspection',
  components: {
@@ -556,6 +556,7 @@
      state: null,
      inspectorList: null,
      typeSource: null,
      taskSource: null,
      sagData: [],
      sagForm: {
        sampleCode: null,
@@ -613,7 +614,7 @@
        inspectionItem: 1,
        inspectionItemSubclass: "20(常温)",
      },
      // 检测条件与检验结论按模板 id 分组:{ [templateId]: { temperature, detectionTime, detectionPlace, deviceIds, insResult } }
      // 检测条件与检验结论按模板 id 分组:{ [templateId]: { temperature, detectionTimeRange, detectionPlace, deviceIds, insResult } }
      otherForm: {},
      equipForm: {
        value0: null,
@@ -688,7 +689,7 @@
      page: {
        total: 0,
        size: 10,
        current: 0,
        current: 1,
      },
      // 文件列表相关--结束
      // 任务切换列表--开始
@@ -729,6 +730,11 @@
  // 用于上传文件的信息
  computed: {
    ...mapGetters(["userId"]),
    reviewerOptions() {
      return this.taskSource === 'QUALITY_MONITOR'
        ? this.personList.filter(item => Number(item.value) !== Number(this.userId))
        : this.personList;
    },
    action() {
      return this.javaApi + "/insOrderPlan/uploadFile";
    },
@@ -737,7 +743,7 @@
      return (
        this.otherForm[this.currentTable] || {
          temperature: null,
          detectionTime: null,
          detectionTimeRange: null,
          detectionPlace: null,
          deviceIds: [],
          insResult: null,
@@ -833,14 +839,16 @@
  },
  methods: {
    syncRouteContext() {
      const { sonLaboratory, orderId, state, inspectorList, typeSource } = this.$route.query;
      const { sonLaboratory, orderId, state, inspectorList, typeSource, taskSource } = this.$route.query;
      const orderChanged = this.id !== orderId;
      this.sonLaboratory = sonLaboratory;
      this.orderId = orderId;
      this.state = state;
      this.inspectorList = inspectorList;
      this.typeSource = typeSource;
      this.taskSource = taskSource;
      if (orderChanged) {
        if (taskSource === 'QUALITY_MONITOR') this.verifyUser = null;
        this.tableLists = [];
        this.tableList = [];
        this.sampleProduct = [];
@@ -1002,6 +1010,7 @@
        laboratory: this.sonLaboratory,
      }).then(async (res) => {
        this.insOrder = res.data.insOrder;
        this.taskSource = this.insOrder.taskSource || this.taskSource;
        if(res.data.insOrder.ifsOrderType==='02wg'){
          //查询零件属性
          this.getPartProps(res.data.insOrder.ifsInventoryId)
@@ -1027,7 +1036,7 @@
        (this.insOrder.templateConditions || []).forEach((item) => {
          this.otherForm[item.templateId] = {
            temperature: item.temperature != null ? item.temperature : null,
            detectionTime: item.detectionTime != null ? item.detectionTime : null,
            detectionTimeRange: readDetectionTimeRange(item),
            detectionPlace: item.detectionPlace != null ? item.detectionPlace : null,
            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
            insResult: item.insResult != null ? item.insResult : null,
@@ -1173,7 +1182,7 @@
      if (!this.otherForm[templateId]) {
        this.otherForm[templateId] = {
          temperature: null,
          detectionTime: null,
          detectionTimeRange: null,
          detectionPlace: null,
          deviceIds: [],
          insResult: null,
@@ -1189,7 +1198,9 @@
        payload.templateId = this.currentTable;
        if (type === "deviceIds") {
          payload.deviceIds = Array.isArray(m) ? [...m] : [];
        } else if (type === "detectionTime" || type === "detectionPlace") {
        } else if (type === "detectionTimeRange") {
          Object.assign(payload, toDetectionTimePayload(m));
        } else if (type === "detectionPlace") {
          payload[type] = m === "" || m == null ? null : m;
        } else {
          payload[type] = Number(m);
@@ -1578,6 +1589,17 @@
    // 检验值输入后触发的函数
    changeInput(m, code, n) {
      if (n) {
        const config = parseInspectionValueAnnotation(n.v && n.v.ps && n.v.ps.value);
        if (config && !config.error && config.decimalPlaces != null && typeof n.v.v === 'string') {
          const numericPattern = config.displayMode === 'SCIENTIFIC'
            ? /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/
            : /^[+-]?\d*\.?\d+$/;
          if (n.v.v.trim() && !numericPattern.test(n.v.v.trim())) {
            this.$message.warning('该检验值必须填写数字');
            return;
          }
          n.v.v = formatInspectionValue(n.v.v, config);
        }
        // 定义一个函数来验证分数是否有效
        if (typeof n.v.v == "string") {
          function isValidFraction(fraction) {
@@ -1708,7 +1730,7 @@
        const v = n.v.v;
        // 能力范围已废弃,检验值类型不再作为判断依据。整串只由算式字符组成时才规范化格式,
        // 出现中文等其它字符即按文本处理原样保留,否则文字会被逐字删掉
        if (typeof v !== "string" || /[^\d.^e>>≥≤<<断裂脆化\-/+]/.test(v)) {
        if (typeof v !== "string" || /[^\d.^eE>>≥≤<<断裂脆化\-/+]/.test(v)) {
          return;
        }
        n.v.v = v
@@ -1750,6 +1772,10 @@
      }
    },
    openAddCheck() {
      if (this.taskSource === 'QUALITY_MONITOR') {
        this.upInsReview(1);
        return;
      }
      this.addCheck = true;
    },
    // 收集模板级检测条件的缺失项(每个模板都要填全)
@@ -1760,7 +1786,7 @@
        if (this.insOrder.ifsOrderType !== "02wg") {
          if (!form.temperature) missing.push(`请填写「${m.templateName}」的温度`);
        }
        if (!form.detectionTime) missing.push(`请选择「${m.templateName}」的检测时间`);
        if (!isCompleteDetectionTimeRange(form.detectionTimeRange)) missing.push(`请选择「${m.templateName}」的检测时间`);
        if (!form.detectionPlace) missing.push(`请填写「${m.templateName}」的检测地点`);
        if (!form.deviceIds || form.deviceIds.length === 0) {
          missing.push(`请选择「${m.templateName}」的设备`);
@@ -1886,9 +1912,8 @@
            id: this.insOrder.id,
            templateId: template.templateId,
            temperature: form.temperature == null ? null : form.temperature,
            detectionTime: form.detectionTime || null,
            ...toDetectionTimePayload(form.detectionTimeRange),
            detectionPlace: form.detectionPlace || null,
            deviceIds: Array.isArray(form.deviceIds) ? [...form.deviceIds] : [],
          });
        }));
      } catch (error) {
@@ -2217,7 +2242,9 @@
    },
    handleDown(row) {
      downFile({ id: row.id }).then((res) => {
        this.$download.saveAs(res.data.fileUrl, row.fileName)
        const resourcePath = Number(res.data.type) === 1 ? "/img/" : "/word/";
        const fileUrl = this.javaApi + resourcePath + encodeURIComponent(res.data.fileUrl);
        this.$download.saveAs(fileUrl, row.fileName);
      })
        .catch((error) => { });
    },
@@ -2284,7 +2311,7 @@
/* 当前检验模板的检测条件与检验结论 */
.template-panel {
  background-color: #f8f9fb;
  border: 1px solid #ebeef5;
  border: 1px solid var(--el-border-color-light);
  border-radius: 3px;
  padding: 16px 16px 4px;
  margin-bottom: 12px;
@@ -2302,13 +2329,21 @@
  flex: none;
}
/* 设备下拉固定宽度,禁止被行内布局压缩,否则选中内容不可见 */
.template-panel:deep(.device-select) {
  display: inline-block !important;
  width: 360px !important;
  min-width: 360px;
  flex: 0 0 360px;
}
.template-panel__unit {
  margin-left: 4px;
  color: #606266;
  color: var(--lims-text-2);
}
.template-panel__conclusion--divided {
  border-top: 1px dashed #e4e7ed;
  border-top: 1px dashed var(--el-border-color);
  padding-top: 12px;
}
@@ -2487,7 +2522,7 @@
}
.inspection .el-drawer__header {
  color: #303133;
  color: var(--lims-text);
  text-align: left;
}