From 78d6b4b2ad22b5dfb956869926135f98426fa3d8 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Thu, 29 Aug 2024 15:14:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=B4=AD=EF=BC=8C=E7=9B=98=E7=82=B9?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../toolsAcceptance/component/codingTools.vue | 225 +++++++++++++----- .../warehousing/Inventory/index.vue | 112 ++++++--- vue.config.js | 2 +- 3 files changed, 249 insertions(+), 90 deletions(-) diff --git a/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue b/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue index 97a9339..0426424 100644 --- a/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue +++ b/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue @@ -156,7 +156,7 @@ :title="title" :visible.sync="open" v-if="open" - width="1000px" + width="80%" append-to-body :close-on-click-modal="false" > @@ -165,32 +165,39 @@ :model="form" :rules="codeRules" :inline="true" - label-width="78px" + label-width="100px" v-if="!isDetail" > - + - + - + + + + + - 剩余待编码数量:{{ + 待编码数量:{{ surplusNoBindNum }} @@ -289,7 +296,7 @@ size="mini" type="text" icon="el-icon-delete" - @click="delCode(scope.row)" + @click="delCode(scope.$index)" >删除 @@ -379,6 +386,7 @@ export default { // pageSize: 10, typeName: undefined, }, + codeInfo: null, // 表单参数 form: { exCode: '', @@ -387,8 +395,9 @@ export default { fixCode: '1', typeId: '', - suffixOneCode: 0, + suffixOneCode: '', suffixTwoCode: 0, + codeNum: '', }, codeList: [], //弹窗列表list getCodeList: [], //已成过的编码list @@ -407,23 +416,33 @@ export default { }, codeRules: { + exCode: [ + { + required: true, + message: '请输入前缀', + trigger: 'blur', + }, + ], + codeNum: [ + { + required: true, + message: '请输入编码数量', + trigger: 'blur', + }, + { + pattern: /^[1-9][0-9]*$/, + message: '请输入大于0且不能以0开头的正整数', + }, + ], suffixOneCode: [ { required: true, - message: '请输入后缀范围', + message: '请输入后缀起始值', trigger: 'blur', }, - // { - // pattern: /^[1-9]\d*$/, - // message: '请输入正整数', - // trigger: 'blur', - // }, - ], - suffixTwoCode: [ { - required: true, - message: '请输入后缀范围', - trigger: 'blur', + pattern: /^[1-9][0-9]*$/, + message: '请输入大于0且不能以0开头的正整数', }, // { // pattern: /^[1-9]\d*$/, @@ -431,6 +450,18 @@ export default { // trigger: 'blur', // }, ], + // suffixTwoCode: [ + // { + // required: true, + // message: '请输入后缀范围', + // trigger: 'blur', + // }, + // // { + // // pattern: /^[1-9]\d*$/, + // // message: '请输入正整数', + // // trigger: 'blur', + // // }, + // ], }, isDetail: false, @@ -453,6 +484,7 @@ export default { }) }, selectType(id) { + console.log(id) getListByMaType({ typeId: id }).then((response) => { this.modelList = response.data }) @@ -467,8 +499,12 @@ export default { }, // 取消按钮 cancel() { - this.reset() + // this.reset() + + this.resetForm('formCodeRef') this.open = false + // this.form.suffixOneCode = '' + // this.form.codeNum = '' }, // 表单重置 reset() { @@ -504,36 +540,37 @@ export default { }, //getCodeList newCodeList /** 编码按钮操作 */ handleCode(row) { console.log(row) - this.reset() - this.form = row - + // this.reset() + // this.form = row + this.codeInfo = row if (!this.form.fixCode) { this.form.fixCode = '1' } - this.$set(this.form, 'str', '') - this.$set(this.form, 'str1', '') + // this.$set(this.form, 'str', '') + // this.$set(this.form, 'str1', '') // this.$set(this.form,'fixCode','1') - let arr = this.form.arrivalTime.split('-') + let arr = row.arrivalTime.split('-') // this.form.exCode = ; // this.form.typeCode=111 - if (!this.form.typeCode) { - this.form.typeCode = '' - } - if (!this.form.specsCode) { - this.form.specsCode = '' - } - this.$set( - this.form, - 'exCode', - 'NSJJ' + - this.form.typeCode + - this.form.specsCode + - arr[0][2] + - arr[0][3] + - arr[1], - ) + // if (!this.form.typeCode) { + // this.form.typeCode = '' + // } + // if (!this.form.specsCode) { + // this.form.specsCode = '' + // } + // this.$set( + // this.form, + // 'exCode', + // 'NSJJ' + + // this.form.typeCode + + // this.form.specsCode + + // arr[0][2] + + // arr[0][3] + + // arr[1], + // ) - this.form.count = row.checkNum + this.form.exCode = 'NSJJ' + arr[0][2] + arr[0][3] + arr[1] + // this.form.count = row.checkNum this.codeList = [] this.open = true this.title = '生成编码' @@ -548,7 +585,7 @@ export default { // }); this.surplusNoBindNum = - parseInt(this.form.checkNum) - parseInt(this.form.bindNum) + parseInt(row.checkNum) - parseInt(row.bindNum) }, //生成列表codeList createCodeList() { @@ -570,8 +607,74 @@ export default { // this.codeList = this.getCodeList.concat(this.newCodeList) // } }, + // 数量变更时 + onChangeCodeNum(val) { + this.$message.closeAll() + let regex = /^[1-9][0-9]*$/ + if (!regex.test(val)) { + this.$message.error('请输入大于0且不能以0开头的正整数') + return + } + if (val * 1 > this.surplusNoBindNum) { + this.$message.error('编码数量不能大于待编码数量') + this.form.codeNum = this.surplusNoBindNum + return + } + }, //填充按钮 fillingCodeList() { + this.$message.closeAll() + this.$refs['formCodeRef'].validate((valid) => { + if (valid) { + if (this.form.codeNum * 1 > this.surplusNoBindNum) { + this.$message.error('编码数量不能大于待编码数量') + this.form.codeNum = this.surplusNoBindNum + return + } + this.codeList = [] + let codeNum = 0 + if ( + !this.form.codeNum || + this.form.codeNum == this.surplusNoBindNum + ) { + codeNum = this.surplusNoBindNum + } else { + codeNum = this.form.codeNum + } + for (let i = 0; i < codeNum; i++) { + let obj = { + typeName: this.codeInfo.typeName, + specificationType: this.codeInfo.specificationType, + typeId: this.codeInfo.typeId, + taskId: this.codeInfo.taskId, + maCode: this.form.suffixOneCode * 1 + i, + assetsCode: '', + fixCode: this.form.fixCode, + } + + this.codeList.push(obj) + } + + this.codeList.forEach((e) => { + if (e.maCode < 10) { + e.maCode = `000${e.maCode}` + } else if (e.maCode < 100) { + e.maCode = `00${e.maCode}` + } else if (e.maCode < 1000) { + e.maCode = `0${e.maCode}` + } else { + } + }) + + this.codeList.forEach((e) => { + e.maCode = this.form.exCode + e.maCode + }) + + // console.log(this.codeList, 'this.codeList') + } + }) + + if (true) return // console.log(Number(this.form.str)) // this.codeList = [] // let num = Number(this.form.str) @@ -768,15 +871,17 @@ export default { this.codeList = this.getCodeList.concat(this.newCodeList) }) }, - delCode(row) { - console.log(row) - this.codeList.forEach((item, index) => { - if (item.maCode == row.maCode) { - this.codeList.splice(index, 1) - } - }) + delCode(index) { + this.codeList.splice(index, 1) + console.log(index, '索引') + // console.log(row) + // this.codeList.forEach((item, index) => { + // if (item.maCode == row.maCode) { + // this.codeList.splice(index, 1) + // } + // }) - this.surplusNoBindNum += 1 + // this.surplusNoBindNum += 1 // const maCode = row.maCode ; // this.$modal.confirm('是否确认删除该数据项?').then(function() { // return delMacodeList(maCode); @@ -791,8 +896,9 @@ export default { this.$tab.closeOpenPage(obj) }, async handleBindDetails(row) { - console.log('🚀 ~ handleBindDetails ~ row:', row.taskId, row) - this.surplusNoBindNum = row.checkNum - row.bindNum + console.log('🚀 ~ handleBindDetails ~ row:', row.taskId) + this.surplusNoBindNum = + parseInt(row.checkNum) - parseInt(row.bindNum) this.open = true this.isDetail = true this.title = '编码绑定详情' @@ -811,7 +917,8 @@ export default { handler(newValue) { if (!newValue) { this.form.suffixOneCode = '' - this.form.suffixTwoCode = '' + // this.form.suffixTwoCode = '' + this.form.codeNum = '' this.form.fixCode = '1' } }, diff --git a/src/views/warehouseManage/warehousing/Inventory/index.vue b/src/views/warehouseManage/warehousing/Inventory/index.vue index 90a151e..d538271 100644 --- a/src/views/warehouseManage/warehousing/Inventory/index.vue +++ b/src/views/warehouseManage/warehousing/Inventory/index.vue @@ -68,7 +68,7 @@ " /> - + /> --> - - + --> @@ -478,7 +482,7 @@ type="textarea" placeholder="请输入备注" maxlength="100" - rows="4" + rows="1" show-word-limit style="width: 400px" /> @@ -537,6 +541,7 @@ :data="codeTableList" v-if="!isNumCheck" @selection-change="handleSelectionChange" + height="400" :stripe="true" > @@ -552,7 +557,7 @@ :show-overflow-tooltip="true" > @@ -930,7 +941,7 @@ export default { remarks: undefined, typeId: undefined, num: undefined, - codePrefix: undefined, + codePrefix: 'PD-CODE', codeSuffixStart: undefined, codeSuffixEnd: undefined, buyPrice: undefined, @@ -960,6 +971,20 @@ export default { ], }, codeFormRules: { + codePrefix: [ + { required: true, message: '请输入前缀', trigger: 'blur' }, + ], + codeSuffixStart: [ + { + required: true, + message: '请输入后缀起始值', + trigger: 'blur', + }, + { + pattern: /^[1-9][0-9]*$/, + message: '请输入大于0且不能以0开头的正整数', + }, + ], putInType: [ { required: true, @@ -1054,7 +1079,7 @@ export default { remarks: undefined, typeId: null, num: undefined, - codePrefix: undefined, + codePrefix: 'PD-CODE', codeSuffixStart: undefined, codeSuffixEnd: undefined, buyPrice: undefined, @@ -1129,7 +1154,7 @@ export default { // 单价: codeForm.buyPrice const buyPrice = this.codeForm.buyPrice || 0 this.codeTableList.push({ - maCode, + maCode: this.codeForm.codeSuffixStart * 1 + i, outFacCode, maVender, thisCheckTime, @@ -1137,6 +1162,20 @@ export default { buyPrice, }) } + this.codeTableList.forEach((e) => { + if (e.maCode < 10) { + e.maCode = `000${e.maCode}` + } else if (e.maCode < 100) { + e.maCode = `00${e.maCode}` + } else if (e.maCode < 1000) { + e.maCode = `0${e.maCode}` + } else { + } + }) + + this.codeTableList.forEach((e) => { + e.maCode = this.codeForm.codePrefix + e.maCode + }) } }) }, @@ -1147,7 +1186,10 @@ export default { this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') } - if (isNaN(this.codeForm.codeSuffixStart) || this.codeForm.codeSuffixStart.includes('.')) { + if ( + isNaN(this.codeForm.codeSuffixStart) || + this.codeForm.codeSuffixStart.includes('.') + ) { this.$message.error('后缀范围请输入整数类型') this.codeForm.codeSuffixStart = '' } @@ -1156,7 +1198,10 @@ export default { if (!this.codeForm.codeSuffixStart) { this.$message.error('请输入后缀范围起始值') this.codeForm.codeSuffixEnd = '' - } else if (isNaN(this.codeForm.codeSuffixEnd) || this.codeForm.codeSuffixEnd.includes('.')) { + } else if ( + isNaN(this.codeForm.codeSuffixEnd) || + this.codeForm.codeSuffixEnd.includes('.') + ) { this.$message.error('后缀范围请输入整数类型') this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') @@ -1415,24 +1460,28 @@ export default { } const res = await getDeviceTypeTree(params) if (type) { - this.disableNodes(res.data, '1'); + this.disableNodes(res.data, '1') } else { - this.disableNodes(res.data, '0'); + this.disableNodes(res.data, '0') } this.deviceTypeTree = res.data }, // 递归禁用节点 disableNodes(nodes, manageType, level = 1) { - nodes.forEach(node => { + nodes.forEach((node) => { node.level = level if (node.children) { - this.disableNodes(node.children, manageType, level + 1); + 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) { + } else if ( + node.manageType && + node.level == 4 && + node.manageType != manageType + ) { node.disabled = true } - }); + }) }, /////// 设备类型树 切换 deviceTypeChange(val) { @@ -1571,7 +1620,10 @@ export default { }, // 校验检验日期 changeCheckTime() { - if (this.codeForm.nextCheckTime && this.codeForm.thisCheckTime > this.codeForm.nextCheckTime) { + if ( + this.codeForm.nextCheckTime && + this.codeForm.thisCheckTime > this.codeForm.nextCheckTime + ) { this.codeForm.nextCheckTime = '' this.$message.warning('下次检验日期不能早于检验日期!') } else if (!this.codeForm.thisCheckTime) { @@ -1600,4 +1652,4 @@ export default { ::v-deep .el-input-number.is-without-controls .el-input__inner { text-align: start; } - \ No newline at end of file + diff --git a/vue.config.js b/vue.config.js index 3a1d6c9..8f1f0ee 100644 --- a/vue.config.js +++ b/vue.config.js @@ -44,7 +44,7 @@ module.exports = { // target: `http://192.168.2.152:39080`, //超 // target: `http://10.40.92.81:8080`, //韩/ - target: `http://192.168.2.81:49080`,//旭/ + target: `http://192.168.2.81:39080`,//旭/ // target: `http://10.40.92.138:28080`, //帅 // target: `http://192.168.2.218:39080`, //福 // target: `http://192.168.2.120:39080`, //跃