绑定编码问题优化
This commit is contained in:
parent
212095bea9
commit
1eab23e306
|
|
@ -156,7 +156,7 @@
|
||||||
:title="title"
|
:title="title"
|
||||||
:visible.sync="open"
|
:visible.sync="open"
|
||||||
v-if="open"
|
v-if="open"
|
||||||
width="1000px"
|
width="80%"
|
||||||
append-to-body
|
append-to-body
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
|
|
@ -165,7 +165,7 @@
|
||||||
:model="form"
|
:model="form"
|
||||||
:rules="codeRules"
|
:rules="codeRules"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="78px"
|
label-width="100px"
|
||||||
v-if="!isDetail"
|
v-if="!isDetail"
|
||||||
>
|
>
|
||||||
<el-input v-model="form.typeId" disabled v-show="false" />
|
<el-input v-model="form.typeId" disabled v-show="false" />
|
||||||
|
|
@ -174,23 +174,32 @@
|
||||||
<el-input v-model="form.exCode" @change="fillingCodeList" />
|
<el-input v-model="form.exCode" @change="fillingCodeList" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="后缀范围" prop="suffixOneCode">
|
<el-form-item label="后缀起始值" prop="suffixOneCode">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.suffixOneCode"
|
v-model="form.suffixOneCode"
|
||||||
placeholder="0001"
|
maxlength="99999999"
|
||||||
maxlength="4"
|
clearable
|
||||||
style="width: 100px"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="suffixTwoCode">
|
<el-form-item label="编码数量" prop="codeNum">
|
||||||
|
<el-input
|
||||||
|
v-model="form.codeNum"
|
||||||
|
type="number"
|
||||||
|
style="width: 120px"
|
||||||
|
@change="onChangeCodeNum"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- <el-form-item prop="suffixTwoCode">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.suffixTwoCode"
|
v-model="form.suffixTwoCode"
|
||||||
placeholder="0005"
|
placeholder="0005"
|
||||||
maxlength="4"
|
maxlength="4"
|
||||||
style="width: 100px"
|
style="width: 100px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="固定资产" prop="fixCode">
|
<el-form-item label="固定资产" prop="fixCode">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.fixCode"
|
v-model="form.fixCode"
|
||||||
|
|
@ -223,7 +232,7 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row class="surplus-code">
|
<el-row class="surplus-code">
|
||||||
剩余待编码数量:<span style="color: red">{{
|
待编码数量:<span style="color: red">{{
|
||||||
surplusNoBindNum
|
surplusNoBindNum
|
||||||
}}</span>
|
}}</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -289,7 +298,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="delCode(scope.row)"
|
@click="delCode(scope.$index)"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -389,6 +398,7 @@ export default {
|
||||||
|
|
||||||
suffixOneCode: 0,
|
suffixOneCode: 0,
|
||||||
suffixTwoCode: 0,
|
suffixTwoCode: 0,
|
||||||
|
codeNum: 0,
|
||||||
},
|
},
|
||||||
codeList: [], //弹窗列表list
|
codeList: [], //弹窗列表list
|
||||||
getCodeList: [], //已成过的编码list
|
getCodeList: [], //已成过的编码list
|
||||||
|
|
@ -407,23 +417,22 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
codeRules: {
|
codeRules: {
|
||||||
|
exCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入前缀',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
suffixOneCode: [
|
suffixOneCode: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入后缀范围',
|
message: '请输入后缀起始值',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// pattern: /^[1-9]\d*$/,
|
|
||||||
// message: '请输入正整数',
|
|
||||||
// trigger: 'blur',
|
|
||||||
// },
|
|
||||||
],
|
|
||||||
suffixTwoCode: [
|
|
||||||
{
|
{
|
||||||
required: true,
|
pattern: /^[1-9][0-9]*$/,
|
||||||
message: '请输入后缀范围',
|
message: '请输入大于0且不能以0开头的正整数',
|
||||||
trigger: 'blur',
|
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// pattern: /^[1-9]\d*$/,
|
// pattern: /^[1-9]\d*$/,
|
||||||
|
|
@ -431,6 +440,18 @@ export default {
|
||||||
// trigger: 'blur',
|
// trigger: 'blur',
|
||||||
// },
|
// },
|
||||||
],
|
],
|
||||||
|
// suffixTwoCode: [
|
||||||
|
// {
|
||||||
|
// required: true,
|
||||||
|
// message: '请输入后缀范围',
|
||||||
|
// trigger: 'blur',
|
||||||
|
// },
|
||||||
|
// // {
|
||||||
|
// // pattern: /^[1-9]\d*$/,
|
||||||
|
// // message: '请输入正整数',
|
||||||
|
// // trigger: 'blur',
|
||||||
|
// // },
|
||||||
|
// ],
|
||||||
},
|
},
|
||||||
isDetail: false,
|
isDetail: false,
|
||||||
|
|
||||||
|
|
@ -571,8 +592,68 @@ export default {
|
||||||
// this.codeList = this.getCodeList.concat(this.newCodeList)
|
// 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() {
|
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))
|
// console.log(Number(this.form.str))
|
||||||
// this.codeList = []
|
// this.codeList = []
|
||||||
// let num = Number(this.form.str)
|
// let num = Number(this.form.str)
|
||||||
|
|
@ -769,15 +850,17 @@ export default {
|
||||||
this.codeList = this.getCodeList.concat(this.newCodeList)
|
this.codeList = this.getCodeList.concat(this.newCodeList)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
delCode(row) {
|
delCode(index) {
|
||||||
console.log(row)
|
this.codeList.splice(index, 1)
|
||||||
this.codeList.forEach((item, index) => {
|
console.log(index, '索引')
|
||||||
if (item.maCode == row.maCode) {
|
// console.log(row)
|
||||||
this.codeList.splice(index, 1)
|
// 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 ;
|
// const maCode = row.maCode ;
|
||||||
// this.$modal.confirm('是否确认删除该数据项?').then(function() {
|
// this.$modal.confirm('是否确认删除该数据项?').then(function() {
|
||||||
// return delMacodeList(maCode);
|
// return delMacodeList(maCode);
|
||||||
|
|
@ -793,6 +876,8 @@ export default {
|
||||||
},
|
},
|
||||||
async handleBindDetails(row) {
|
async handleBindDetails(row) {
|
||||||
console.log('🚀 ~ handleBindDetails ~ row:', row.taskId)
|
console.log('🚀 ~ handleBindDetails ~ row:', row.taskId)
|
||||||
|
this.surplusNoBindNum =
|
||||||
|
parseInt(row.checkNum) - parseInt(row.bindNum)
|
||||||
this.open = true
|
this.open = true
|
||||||
this.isDetail = true
|
this.isDetail = true
|
||||||
this.title = '编码绑定详情'
|
this.title = '编码绑定详情'
|
||||||
|
|
@ -810,8 +895,9 @@ export default {
|
||||||
open: {
|
open: {
|
||||||
handler(newValue) {
|
handler(newValue) {
|
||||||
if (!newValue) {
|
if (!newValue) {
|
||||||
this.form.suffixOneCode = ''
|
this.form.suffixOneCode = 0
|
||||||
this.form.suffixTwoCode = ''
|
// this.form.suffixTwoCode = ''
|
||||||
|
this.form.codeNum = 0
|
||||||
this.form.fixCode = '1'
|
this.form.fixCode = '1'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue