From 48dbc1cbabdabc6075719bc2980181a8df4c43a9 Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Wed, 12 Jun 2024 18:44:06 +0800 Subject: [PATCH] fix: 2049-2050-2051-2057 --- .../warehousing/Inventory/index.vue | 54 +++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/sgzb-ui/src/views/warehouseManage/warehousing/Inventory/index.vue b/sgzb-ui/src/views/warehouseManage/warehousing/Inventory/index.vue index ba5b1c5c..8b65d44b 100644 --- a/sgzb-ui/src/views/warehouseManage/warehousing/Inventory/index.vue +++ b/sgzb-ui/src/views/warehouseManage/warehousing/Inventory/index.vue @@ -241,6 +241,7 @@ v-model="codeForm.codePrefix" placeholder="请输入前缀" clearable + maxlength="20" style="width: 220px" /> @@ -257,6 +258,7 @@ v-model="codeForm.codeSuffixStart" clearable placeholder="请输入后缀范围起始值" + maxlength="10" style="width: 185px" @change=" changeSuffixStart(codeForm.codeSuffixStart) @@ -273,6 +275,7 @@ v-model="codeForm.codeSuffixEnd" clearable placeholder="请输入后缀范围结束值" + maxlength="10" style="width: 185px" @change="changeSuffixEnd" /> @@ -291,6 +294,7 @@ placeholder="请输入单价" clearable :min="0" + :max="999999999" :controls="false" style="width: 13vw" /> @@ -456,6 +460,7 @@ v-model="codeForm.checkMan" placeholder="请输入检验人" clearable + maxlength="20" style="width: 220px" /> @@ -553,6 +558,7 @@ @@ -567,6 +573,7 @@ @@ -646,6 +653,7 @@ :precision="2" placeholder="请输入单价" :min="0" + :max="999999999" :controls="false" clearable style="width: 160px" @@ -730,6 +738,7 @@ clearable :controls="false" :min="1" + :max="99" style="width: 10vw" /> @@ -754,6 +763,7 @@ align="center" :show-overflow-tooltip="true" clearable + maxlength="100" > @@ -983,7 +993,7 @@ export default { created() { this.getList() this.getTypeList() - this.GetDeviceTypeTree() + // this.GetDeviceTypeTree() this.supplierInfoList() }, methods: { @@ -1137,16 +1147,17 @@ export default { this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') } - if (!this.codeForm.codeSuffixStart) { - this.codeForm.codeSuffixEnd = '' + if (isNaN(this.codeForm.codeSuffixStart) || this.codeForm.codeSuffixStart.includes('.')) { + this.$message.error('后缀范围请输入整数类型') + this.codeForm.codeSuffixStart = '' } }, changeSuffixEnd() { if (!this.codeForm.codeSuffixStart) { this.$message.error('请输入后缀范围起始值') this.codeForm.codeSuffixEnd = '' - } else if (isNaN(this.codeForm.codeSuffixEnd)) { - this.$message.error('后缀范围请输入数字类型') + } else if (isNaN(this.codeForm.codeSuffixEnd) || this.codeForm.codeSuffixEnd.includes('.')) { + this.$message.error('后缀范围请输入整数类型') this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') } else { @@ -1185,7 +1196,7 @@ export default { this.title = '数量盘点入库' this.resetCodeForm() this.getUnitData() - this.GetDeviceTypeTree() + this.GetDeviceTypeTree(this.isNumCheck) this.$nextTick(() => { this.$refs['codeForm'].clearValidate() }) @@ -1199,7 +1210,7 @@ export default { this.title = '编码盘点入库' this.resetCodeForm() this.getUnitData() - this.GetDeviceTypeTree() + this.GetDeviceTypeTree(this.isNumCheck) this.$nextTick(() => { this.$refs['codeForm'].clearValidate() }) @@ -1256,6 +1267,14 @@ export default { this.requiredMaCode = this.codeTableList.some( (item) => !item.maCode, ) + // 过滤this.codeTableList中 如果有maCode是重复数据, 则不允许提交 + const maCodeList = this.codeTableList.map( + (item) => item.maCode, + ) + if (new Set(maCodeList).size !== maCodeList.length) { + this.$message.error('设备编码不能重复') + return + } if (this.requiredMaCode) { this.$message.error('设备编码不能为空') return @@ -1390,14 +1409,31 @@ export default { }) }, // 获取 设备树结构数据 - async GetDeviceTypeTree() { + async GetDeviceTypeTree(type) { const params = { level: 4, } const res = await getDeviceTypeTree(params) - console.log(res) + if (type) { + this.disableNodes(res.data, '1'); + } else { + this.disableNodes(res.data, '0'); + } this.deviceTypeTree = res.data }, + // 递归禁用节点 + disableNodes(nodes, manageType, level = 1) { + nodes.forEach(node => { + node.level = level + if (node.children) { + this.disableNodes(node.children, manageType, level + 1); + } else if (!node.children && node.level < 4) { + node.disabled = true + } else if(node.manageType && node.level == 4 && node.manageType != manageType) { + node.disabled = true + } + }); + }, /////// 设备类型树 切换 deviceTypeChange(val) { console.log('🚀 ~ deviceTypeChange ~ val:', val)