From b727742da6b743c8386d92ecdb166f4d4d1fa110 Mon Sep 17 00:00:00 2001 From: jiang Date: Fri, 19 Dec 2025 18:20:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 4 +- .../equipmentInput/index.vue | 133 ++- .../order/sharedOutList.vue | 1 + src/views/EquipmentTypeConfig/index.vue | 506 ++++------- src/views/address-manage/index.vue | 819 +++++++++--------- src/views/business/apply/addApply.vue | 39 +- src/views/business/outbound/details.vue | 6 +- src/views/business/warehouse/details.vue | 4 +- src/views/business/warehouse/index.vue | 4 +- src/views/material/ma/type/index.vue | 1 + src/views/toolsManage/toolsLedger/index.vue | 15 +- 11 files changed, 791 insertions(+), 741 deletions(-) diff --git a/.env.production b/.env.production index f4bf5b8c..b032d264 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,6 @@ VUE_APP_TITLE = 机械化施工装备管理(共享)平台 ENV = 'production' # 机械化施工装备管理(共享)平台/生产环境 -# VUE_APP_BASE_API = '/prod-api' +VUE_APP_BASE_API = '/prod-api' # 宏源 -VUE_APP_BASE_API = '/iws/jxhzb-api' \ No newline at end of file +#VUE_APP_BASE_API = '/iws/jxhzb-api' diff --git a/src/views/EquipmentEntryApproval/equipmentInput/index.vue b/src/views/EquipmentEntryApproval/equipmentInput/index.vue index 98ed1c9d..11db73cb 100644 --- a/src/views/EquipmentEntryApproval/equipmentInput/index.vue +++ b/src/views/EquipmentEntryApproval/equipmentInput/index.vue @@ -110,23 +110,24 @@ --> - + + - + @@ -327,6 +328,9 @@ export default { specificationModel: '', originalCode: '', manufacturer: '', + + minOriginalValue: '', + maxOriginalValue: '', manufacturerId: '', minBuyPrice: '', maxBuyPrice: '', @@ -335,6 +339,11 @@ export default { pageNum: 1, pageSize: 10 }, + // 用于存储上一次的有效值,避免循环验证 + lastValidValues: { + minOriginalValue: '', + maxOriginalValue: '' + }, manufacturerList: [], tableData: [], columns2: [], @@ -374,6 +383,117 @@ export default { this.getManufacturerSelectList() }, methods: { + handleNumberInput(key) { + let value = this.queryParams[key] || '' + // 1. 清理输入 + const cleanedValue = this.cleanNumberInput(value) + + // 2. 存储为上次有效值(清理后) + this.lastValidValues[key] = cleanedValue + + // 3. 根据输入类型进行验证 + if (key === 'minOriginalValue') { + this.queryParams[key] = this.validateMinValue(cleanedValue) + } else if (key === 'maxOriginalValue') { + this.queryParams[key] = this.validateMaxValue(cleanedValue) + } else { + this.queryParams[key] = cleanedValue + } + + // 4. 确保响应式更新 + this.$forceUpdate() + }, + + // 清理数字输入 + cleanNumberInput(input) { + if (!input) return '' + + // 过滤非数字和小数点 + let cleaned = input.replace(/[^\d.]/g, '') + + // 处理多个小数点 + const dotIndex = cleaned.indexOf('.') + if (dotIndex !== -1) { + const before = cleaned.substring(0, dotIndex + 1) + const after = cleaned.substring(dotIndex + 1).replace(/\./g, '') + cleaned = before + after + } + + // 限制小数位数 + const parts = cleaned.split('.') + if (parts.length > 1) { + cleaned = parts[0] + '.' + parts[1].slice(0, 2) + } + + return cleaned + }, + + // 验证最小值(不能大于最大值) + validateMinValue(value) { + // 如果是空值或纯小数点,直接返回 + if (!value || value === '.') return value + + const maxValue = this.queryParams.maxOriginalValue + const minNum = this.safeParseNumber(value) + const maxNum = this.safeParseNumber(maxValue) + + // 如果最大值无效,直接返回清理后的值 + if (maxNum === null) return value + + // 如果最小值大于最大值,则使用最大值 + if (minNum !== null && minNum > maxNum) { + return maxValue + } + + return value + }, + + // 验证最大值(不能小于最小值) + validateMaxValue(value) { + // 如果是空值或纯小数点,直接返回 + if (!value || value === '.') return value + + const minValue = this.queryParams.minOriginalValue + const maxNum = this.safeParseNumber(value) + const minNum = this.safeParseNumber(minValue) + + // 如果最小值无效,直接返回清理后的值 + if (minNum === null) return value + + // 如果最大值小于最小值,则使用最小值 + if (maxNum !== null && maxNum < minNum) { + return minValue + } + + return value + }, + + // 安全解析数字 + safeParseNumber(str) { + if (!str || str === '.' || isNaN(Number(str))) { + return null + } + return Number(str) + }, + + // 同时验证两个值(在表单提交前调用) + validateNumberRange() { + const minNum = this.safeParseNumber(this.queryParams.minOriginalValue) + const maxNum = this.safeParseNumber(this.queryParams.maxOriginalValue) + + if (minNum !== null && maxNum !== null && minNum > maxNum) { + // 交换值,使最小值 <= 最大值 + const temp = this.queryParams.minOriginalValue + this.queryParams.minOriginalValue = this.queryParams.maxOriginalValue + this.queryParams.maxOriginalValue = temp + + // 提示用户 + this.$message.warning('已自动调整数值范围,确保最小值 ≤ 最大值') + return false + } + + return true + }, goBack() { // this.$router.go(-1) this.$router.push({ path: '/equipment/equipment-entry-approval' }) @@ -401,6 +521,7 @@ export default { * 获取装备申请列表 */ getEquipmentApplyList() { + this.validateNumberRange() this.queryParams.startOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[0] : '' this.queryParams.endOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[1] : '' this.queryParams.startProductionDate = this.productionDate ? this.productionDate[0] : '' diff --git a/src/views/EquipmentSharedLease/order/sharedOutList.vue b/src/views/EquipmentSharedLease/order/sharedOutList.vue index 7b0d31d9..1c4fc4e6 100644 --- a/src/views/EquipmentSharedLease/order/sharedOutList.vue +++ b/src/views/EquipmentSharedLease/order/sharedOutList.vue @@ -404,6 +404,7 @@ export default { //通过 handleOut(row) { row.category = '' + row.proCode = this.queryParams.proCode this.$confirm('是否确定出库?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', diff --git a/src/views/EquipmentTypeConfig/index.vue b/src/views/EquipmentTypeConfig/index.vue index 59cc3008..629e6c9d 100644 --- a/src/views/EquipmentTypeConfig/index.vue +++ b/src/views/EquipmentTypeConfig/index.vue @@ -15,9 +15,9 @@ style="margin-bottom: 20px" /> -
+
{{ node.label }} - + 新增 + 导出 + -
+
- - - + @@ -282,7 +254,7 @@ @@ -294,41 +266,23 @@ size="small" class="detail-form" > - - - - - -
- - 点击修改 -
- - -
-
- - - - - -
+ + + + + + +