From 1eab23e306fb034bb4723f3791214315bcd59585 Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Tue, 27 Aug 2024 18:09:30 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E7=BC=96=E7=A0=81=E9=97=AE?=
=?UTF-8?q?=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 | 148 ++++++++++++++----
1 file changed, 117 insertions(+), 31 deletions(-)
diff --git a/sgzb-ui/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue b/sgzb-ui/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue
index f6c60e4b..8f1f25e0 100644
--- a/sgzb-ui/src/views/warehouseManage/newPurchase/toolsAcceptance/component/codingTools.vue
+++ b/sgzb-ui/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,7 +165,7 @@
:model="form"
:rules="codeRules"
:inline="true"
- label-width="78px"
+ label-width="100px"
v-if="!isDetail"
>
@@ -174,23 +174,32 @@
-
+
-
+
+
+
+
+
- 剩余待编码数量:{{
+ 待编码数量:{{
surplusNoBindNum
}}
@@ -289,7 +298,7 @@
size="mini"
type="text"
icon="el-icon-delete"
- @click="delCode(scope.row)"
+ @click="delCode(scope.$index)"
>删除
@@ -389,6 +398,7 @@ export default {
suffixOneCode: 0,
suffixTwoCode: 0,
+ codeNum: 0,
},
codeList: [], //弹窗列表list
getCodeList: [], //已成过的编码list
@@ -407,23 +417,22 @@ export default {
},
codeRules: {
+ exCode: [
+ {
+ required: true,
+ message: '请输入前缀',
+ trigger: 'blur',
+ },
+ ],
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 +440,18 @@ export default {
// trigger: 'blur',
// },
],
+ // suffixTwoCode: [
+ // {
+ // required: true,
+ // message: '请输入后缀范围',
+ // trigger: 'blur',
+ // },
+ // // {
+ // // pattern: /^[1-9]\d*$/,
+ // // message: '请输入正整数',
+ // // trigger: 'blur',
+ // // },
+ // ],
},
isDetail: false,
@@ -571,8 +592,68 @@ 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.codeList = []
+ this.$refs['formCodeRef'].validate((valid) => {
+ if (valid) {
+ 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.form.typeName,
+ specificationType: this.form.specificationType,
+ typeId: this.form.typeId,
+ taskId: this.form.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)
@@ -769,15 +850,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);
@@ -793,6 +876,8 @@ export default {
},
async handleBindDetails(row) {
console.log('🚀 ~ handleBindDetails ~ row:', row.taskId)
+ this.surplusNoBindNum =
+ parseInt(row.checkNum) - parseInt(row.bindNum)
this.open = true
this.isDetail = true
this.title = '编码绑定详情'
@@ -810,8 +895,9 @@ export default {
open: {
handler(newValue) {
if (!newValue) {
- this.form.suffixOneCode = ''
- this.form.suffixTwoCode = ''
+ this.form.suffixOneCode = 0
+ // this.form.suffixTwoCode = ''
+ this.form.codeNum = 0
this.form.fixCode = '1'
}
},