From 30250b7570c95ea0406727823935cd9ed85e7d75 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Wed, 5 Nov 2025 10:59:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E6=9C=89=E9=87=8F=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/stquery/stquery.js | 26 +- .../material/stquery/deviceStatusRecord.vue | 273 ++++++++++++++++-- 2 files changed, 267 insertions(+), 32 deletions(-) diff --git a/src/api/stquery/stquery.js b/src/api/stquery/stquery.js index 3cc09462..be37e3d4 100644 --- a/src/api/stquery/stquery.js +++ b/src/api/stquery/stquery.js @@ -87,7 +87,7 @@ export function getOutRecordListApi(query) { params: query }) } - + // 在库详情查询 export function getStorageInfoListApi(query) { @@ -120,7 +120,7 @@ export function getOutRecordListApi(query) { method: 'get', params: query }) - } + } // 修饰待入库详情查询 export function getRepairInputListApi(query) { return request({ @@ -156,7 +156,7 @@ export function getOutRecordListApi(query) { params: query }) } - + // 获取电子标签下拉框 export function getSelectionList(query) { return request({ @@ -165,7 +165,7 @@ export function getOutRecordListApi(query) { params: query }) } - + // 获取一级设备类型下拉框 export function getOptionListApi(query) { return request({ @@ -202,6 +202,24 @@ export function getPartUsingListApi(query) { }) } +//线路类型下拉 +export function getLintTypeList(data = {}) { + return request({ + url: '/material/select/getLintTypeList', + method: 'post', + data + }) +} + +//物资类型下拉 +export function getMaterialTypeList(data = {}) { + return request({ + url: '/material/select/getMaterialTypeList', + method: 'post', + data + }) +} + diff --git a/src/views/material/stquery/deviceStatusRecord.vue b/src/views/material/stquery/deviceStatusRecord.vue index c547994e..ab201455 100644 --- a/src/views/material/stquery/deviceStatusRecord.vue +++ b/src/views/material/stquery/deviceStatusRecord.vue @@ -9,22 +9,98 @@ style="width: 240px" /> - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + // 如果返回的是对象数组,根据实际字段调整 + return { + value: item.typeId, + label: item.typeName + } + }) + } else { + this.$message.error('获取施工类型下拉失败') + this.lineTypeOptions = [] // 失败时设置为空数组 + } + } catch (error) { + console.error('获取施工类型下拉列表失败:', error) + this.$message.error('获取施工类型下拉列表失败') + this.lineTypeOptions = [] // 异常时设置为空数组 + } + }, + // 线路类型变化处理 + async handleLineTypeChange(selectedLineTypes) { + // 清空物资类型选择 + this.queryParams.materialType = null + this.materialTypeOptions=[] + this.queryParams.typeName=null + this.typeNameOptions=[] + this.queryParams.typeModelName=null + this.typeModelNameOptions=[] + + if (!selectedLineTypes || selectedLineTypes.length === 0) { + this.materialTypeOptions = [] + } + + // 获取物资类型数据 + await this.getMaterialTypeList(selectedLineTypes) + }, + async getMaterialTypeList(lineTypes) { + const params = { + constructionType:lineTypes + } + try { + // 调用接口获取物资类型数据 + const res = await getMaterialTypeList(params) + + if (res.code === 200 && res.data) { + // 处理返回的物资类型数据 + const materialTypes = res.data.map(item => ({ + value: item.typeId, + label: item.typeName + })) + + // 更新选项并缓存 + this.materialTypeOptions = materialTypes + } else { + this.$message.error('获取物资类型失败') + this.materialTypeOptions = [] + } + } catch (error) { + console.error('获取物资类型列表失败:', error) + this.$message.error('获取物资类型列表失败') + this.materialTypeOptions = [] + } + }, + async handleMaterialTypeChange(e){ + this.queryParams.typeName=null + this.typeNameOptions=[] + this.queryParams.typeModelName=null + this.typeModelNameOptions=[] + getDeviceType({ level: 3, typeId:e }).then(response => { + let matNameRes = response.data + this.typeNameOptions = matNameRes.map((item) => { + return { + label: item.typeName, + value: item.typeId + } + }) + }) + }, + async handleTypeNameChange(e){ + this.queryParams.typeModelName=null + this.typeModelNameOptions=[] + getDeviceType({ level: 4, typeId:e }).then(response => { + let matNameRes = response.data + this.typeModelNameOptions = matNameRes.map((item) => { + return { + label: item.typeName, + value: item.typeId + } + }) + }) + }, + getDeviceType() { + getDeviceType({ level: 3 }).then(response => { + let matNameRes = response.data + this.typeNameOptions = matNameRes.map((item) => { + return { + label: item.typeName, + value: item.typeId + } + }) + }) + getDeviceType({ level: 4 }).then(response => { + let matModelRes = response.data + this.typeModelNameOptions = matModelRes.map((item) => { + return { + label: item.typeName, + value: item.typeId + } + }) + }) + }, indexContinuationForTable(num, size) { let number = (num - 1) * size console.log(number)