yyb
2026-05-22 552ec6b7d8ccc56c379da195fc6c9c74312b1070
src/pages/qualityManagement/processInspection/add.vue
@@ -51,6 +51,7 @@
      </up-form-item>
      <up-form-item label="指标选择"
                    prop="testStandardId"
                    required
                    border-bottom>
        <up-input v-model="testStandardDisplay"
                  placeholder="请选择指标"
@@ -184,11 +185,15 @@
      </up-button>
    </view>
    <!-- 日期选择器 -->
    <up-popup v-model:show="showDate"
              mode="date"
              :start-year="2020"
              :end-year="2030"
              @confirm="confirmDate" />
    <up-popup :show="showDate"
              mode="bottom"
              @close="showDate = false">
      <up-datetime-picker :show="true"
                          v-model="pickerValue"
                          @confirm="confirmDate"
                          @cancel="showDate = false"
                          mode="date" />
    </up-popup>
    <!-- 工序选择 -->
    <up-action-sheet :show="showprocessSheet"
                     :actions="processOptions"
@@ -302,7 +307,7 @@
<script setup>
  import { ref, computed, onMounted, nextTick } from "vue";
  import { onShow } from "@dcloudio/uni-app";
  import { onShow, onLoad } from "@dcloudio/uni-app";
  import PageHeader from "@/components/PageHeader.vue";
  import dayjs from "dayjs";
  import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
@@ -313,8 +318,8 @@
    qualityInspectParamInfo,
    qualityInspectDetailByProductId,
    getQualityTestStandardParamByTestStandardId,
    list,
  } from "@/api/qualityManagement/materialInspection.js";
  import { getProcessList } from "@/api/productionManagement/processManagement.js";
  import { userListNoPage } from "@/api/system/user.js";
  // 显示提示信息
@@ -442,7 +447,7 @@
      { required: true, message: "请选择产品型号", trigger: "change" },
    ],
    testStandardId: [
      { required: false, message: "请选择指标", trigger: "change" },
      { required: true, message: "请选择指标", trigger: "change" },
    ],
    unit: [{ required: false, message: "请输入", trigger: "blur" }],
    quantity: [{ required: true, message: "请输入", trigger: "blur" }],
@@ -454,7 +459,7 @@
  // 是否为编辑模式
  const isEdit = computed(() => {
    const id = getPageId();
    const id = optionsId.value;
    return !!id;
  });
@@ -463,13 +468,6 @@
    const v = form.value || {};
    return !!(v.productMainId != null || v.purchaseLedgerId != null);
  });
  // 获取页面ID
  const getPageId = () => {
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1];
    return currentPage.options.id;
  };
  // 返回上一页
  const goBack = () => {
@@ -609,8 +607,8 @@
  // 获取工序列表
  const getprocessList = () => {
    list().then(res => {
      processList.value = res.data;
    getProcessList({ size: -1, current: -1 }).then(res => {
      processList.value = res.data?.records || res.data || [];
    });
  };
@@ -698,6 +696,10 @@
        showToast("请选择产品");
        return;
      }
      if (!form.value.testStandardId) {
        showToast("请选择指标");
        return;
      }
      if (!form.value.checkResult) {
        showToast("请选择检测结果");
        return;
@@ -706,7 +708,7 @@
      loading.value = true;
      form.value.inspectType = 1;
      if (isEdit.value) {
      if (!isEdit.value) {
        tableData.value.forEach(item => {
          delete item.id;
        });
@@ -737,7 +739,7 @@
  // 初始化表单
  const initForm = async () => {
    const id = getPageId();
    const id = optionsId.value;
    if (id) {
      // 编辑模式,加载数据
      // 先重置表单数据
@@ -890,6 +892,11 @@
  onShow(() => {
    initForm();
  });
  const optionsId = ref("");
  onLoad(options => {
    optionsId.value = options.id || "";
    initForm();
  });
</script>
<style scoped lang="scss">