| | |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="选择设备" |
| | | prop="deviceId" |
| | | width="150"> |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.productType === 2">--</span> |
| | | <el-select v-else |
| | | v-model="scope.row.deviceId" |
| | | placeholder="请选择设备" |
| | | filterable |
| | | clearable |
| | | @change="handleDeviceChange(scope.row, scope.$index)"> |
| | | <el-option v-for="device in iotDeviceList" |
| | | :key="device.id" |
| | | :label="device.deviceName" |
| | | :value="device.id" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="库位" |
| | | prop="storageLocation" |
| | | width="120"> |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.productType === 2">--</span> |
| | | <el-input v-else |
| | | v-model="scope.row.storageLocation" |
| | | placeholder="自动获取" |
| | | disabled /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="入库审核状态" |
| | | prop="stockInApprovalStatus" |
| | | width="120"> |
| | |
| | | </el-row> |
| | | <el-row :gutter="30" v-if="productForm.productType !== 2"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择设备:" |
| | | prop="deviceId"> |
| | | <el-select v-model="productForm.deviceId" |
| | | placeholder="请选择设备" |
| | | filterable |
| | | clearable |
| | | style="width: 100%" |
| | | @change="handleProductDeviceChange"> |
| | | <el-option v-for="device in iotDeviceList" |
| | | :key="device.id" |
| | | :label="device.deviceName" |
| | | :value="device.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="库位:" |
| | | prop="storageLocation"> |
| | | <el-input v-model="productForm.storageLocation" |
| | | placeholder="选择设备后自动获取" |
| | | disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30" v-if="productForm.productType !== 2"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="是否质检:" |
| | | prop="isChecked"> |
| | | <el-radio-group v-model="productForm.isChecked"> |
| | |
| | | const salesContractList = ref([]); |
| | | const supplierList = ref([]); |
| | | const contractList = ref([]); // 供应商合同列表 |
| | | const iotDeviceList = ref([]); // IoT设备列表 |
| | | const contractFileDialogVisible = ref(false); |
| | | const contractFileList = ref([]); |
| | | const tableLoading = ref(false); |
| | |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { getSparePartsList } from "@/api/equipmentManagement/spareParts.js"; |
| | | import { getSupplierContractList, getSupplierContractFilesByNo } from "@/api/basicData/supplierContract.js"; |
| | | import { getLedgerPage } from "@/api/equipmentManagement/ledger.js"; |
| | | import dayjs from "dayjs"; |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | | |
| | |
| | | invoiceType: "", |
| | | warnNum: "", |
| | | isChecked: false, |
| | | deviceId: "", |
| | | storageLocation: "", |
| | | }, |
| | | productRules: { |
| | | productId: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | } |
| | | }; |
| | | |
| | | // 获取IoT设备列表 |
| | | const getIotDeviceList = async () => { |
| | | try { |
| | | const res = await getLedgerPage({ |
| | | isIotDevice: 1, |
| | | page: 1, |
| | | size: 999, |
| | | }); |
| | | if (res.data && res.data.records) { |
| | | iotDeviceList.value = res.data.records; |
| | | } |
| | | } catch (error) { |
| | | console.error("获取IoT设备列表失败:", error); |
| | | } |
| | | }; |
| | | |
| | | // 设备选择变更时,自动填充库位 |
| | | const handleDeviceChange = (row, index) => { |
| | | const device = iotDeviceList.value.find(d => d.id === row.deviceId); |
| | | if (device) { |
| | | row.storageLocation = device.storageLocation || ''; |
| | | } else { |
| | | row.storageLocation = ''; |
| | | } |
| | | }; |
| | | |
| | | // 产品弹窗中设备选择变更时,自动填充库位 |
| | | const handleProductDeviceChange = (deviceId) => { |
| | | const device = iotDeviceList.value.find(d => d.id === deviceId); |
| | | if (device) { |
| | | productForm.value.storageLocation = device.storageLocation || ''; |
| | | } else { |
| | | productForm.value.storageLocation = ''; |
| | | } |
| | | }; |
| | | |
| | | // 格式化文件大小 |
| | | const formatFileSize = (bytes) => { |
| | | if (!bytes) return '0 B'; |
| | |
| | | onMounted(() => { |
| | | getList(); |
| | | getTemplateList(); |
| | | getIotDeviceList(); |
| | | }); |
| | | </script> |
| | | |