src/pages/productionManagement/productionReport/index.vue
@@ -40,6 +40,15 @@
                   @click="openProducerPicker"
                   suffix-icon="arrow-down" />
        </u-form-item>
        <!-- 使用设备 -->
        <u-form-item label="使用设备"
                     prop="deviceId">
          <u-input v-model="form.deviceName"
                   placeholder="请选择使用设备(选填)"
                   readonly
                   @click="openDevicePicker"
                   suffix-icon="arrow-down" />
        </u-form-item>
        <!-- 工时 -->
        <u-form-item label="工时"
                     v-if="form.type == 0"
@@ -115,6 +124,12 @@
                     title="选择生产人"
                     @select="onProducerConfirm"
                     @close="showProducerPicker = false" />
    <!-- 使用设备选择器 -->
    <up-action-sheet :show="showDevicePicker"
                     :actions="deviceList"
                     title="选择使用设备"
                     @select="onDeviceConfirm"
                     @close="showDevicePicker = false" />
    <!-- 参数选择器 -->
    <up-action-sheet :show="showParamSelect"
                     :actions="paramOptions"
@@ -142,6 +157,7 @@
    });
  };
  import { addProductMain } from "@/api/productionManagement/productionReporting";
  import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
  import { getInfo } from "@/api/login";
  import { userListNoPageByTenantId } from "@/api/system/user";
  import {
@@ -167,10 +183,39 @@
    workHour: 0,
    type: null,
    paramGroups: {},
    deviceId: "",
    deviceName: "",
  });
  const showProducerPicker = ref(false);
  const producerList = ref([]);
  // 使用设备选择
  const showDevicePicker = ref(false);
  const deviceList = ref([]);
  const openDevicePicker = async () => {
    if (deviceList.value.length === 0) {
      try {
        const { data } = await getDeviceLedger();
        const rows = Array.isArray(data) ? data : data?.records || [];
        deviceList.value = rows.map(item => ({
          name: item.deviceName || item.name || "-",
          value: item.id,
        }));
      } catch (error) {
        console.error("加载设备列表失败:", error);
        return;
      }
    }
    showDevicePicker.value = true;
  };
  const onDeviceConfirm = e => {
    form.value.deviceId = e.value;
    form.value.deviceName = e.name;
    showDevicePicker.value = false;
  };
  const params = ref([]);
  const dictOptions = ref({});
@@ -361,6 +406,7 @@
        form.value.productionOrderRoutingOperationId,
      productionOrderId: form.value.productionOrderId,
      workHour: form.value.workHour,
      deviceId: form.value.deviceId || undefined,
      productionOperationParamList: productionOperationParamList,
    };