盘点入库优化

This commit is contained in:
binbin_pan 2024-06-12 18:48:45 +08:00
parent cf8e5eac70
commit 1fd8e4d0a4
1 changed files with 47 additions and 10 deletions

View File

@ -241,6 +241,7 @@
v-model="codeForm.codePrefix" v-model="codeForm.codePrefix"
placeholder="请输入前缀" placeholder="请输入前缀"
clearable clearable
maxlength="20"
style="width: 220px" style="width: 220px"
/> />
</el-form-item> </el-form-item>
@ -257,6 +258,7 @@
v-model="codeForm.codeSuffixStart" v-model="codeForm.codeSuffixStart"
clearable clearable
placeholder="请输入后缀范围起始值" placeholder="请输入后缀范围起始值"
maxlength="10"
style="width: 185px" style="width: 185px"
@change=" @change="
changeSuffixStart(codeForm.codeSuffixStart) changeSuffixStart(codeForm.codeSuffixStart)
@ -273,6 +275,7 @@
v-model="codeForm.codeSuffixEnd" v-model="codeForm.codeSuffixEnd"
clearable clearable
placeholder="请输入后缀范围结束值" placeholder="请输入后缀范围结束值"
maxlength="10"
style="width: 185px" style="width: 185px"
@change="changeSuffixEnd" @change="changeSuffixEnd"
/> />
@ -291,6 +294,7 @@
placeholder="请输入单价" placeholder="请输入单价"
clearable clearable
:min="0" :min="0"
:max="999999999"
:controls="false" :controls="false"
style="width: 13vw" style="width: 13vw"
/> />
@ -456,6 +460,7 @@
v-model="codeForm.checkMan" v-model="codeForm.checkMan"
placeholder="请输入检验人" placeholder="请输入检验人"
clearable clearable
maxlength="20"
style="width: 220px" style="width: 220px"
/> />
</el-form-item> </el-form-item>
@ -553,6 +558,7 @@
<el-input <el-input
v-model="row.maCode" v-model="row.maCode"
placeholder="请输入设备编码" placeholder="请输入设备编码"
maxlength="30"
@blur="handleMaCodeBlur(row)" @blur="handleMaCodeBlur(row)"
></el-input> ></el-input>
</template> </template>
@ -567,6 +573,7 @@
<el-input <el-input
v-model="row.outFacCode" v-model="row.outFacCode"
placeholder="请输入出厂编码" placeholder="请输入出厂编码"
maxlength="30"
></el-input> ></el-input>
</template> </template>
</el-table-column> </el-table-column>
@ -646,6 +653,7 @@
:precision="2" :precision="2"
placeholder="请输入单价" placeholder="请输入单价"
:min="0" :min="0"
:max="999999999"
:controls="false" :controls="false"
clearable clearable
style="width: 160px" style="width: 160px"
@ -730,6 +738,7 @@
clearable clearable
:controls="false" :controls="false"
:min="1" :min="1"
:max="99"
style="width: 10vw" style="width: 10vw"
/> />
</template> </template>
@ -754,6 +763,7 @@
align="center" align="center"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
clearable clearable
maxlength="100"
></el-input> ></el-input>
</template> </template>
</el-table-column> </el-table-column>
@ -983,7 +993,7 @@ export default {
created() { created() {
this.getList() this.getList()
this.getTypeList() this.getTypeList()
this.GetDeviceTypeTree() // this.GetDeviceTypeTree()
this.supplierInfoList() this.supplierInfoList()
}, },
methods: { methods: {
@ -1137,16 +1147,17 @@ export default {
this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart =
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
} }
if (!this.codeForm.codeSuffixStart) { if (isNaN(this.codeForm.codeSuffixStart) || this.codeForm.codeSuffixStart.includes('.')) {
this.codeForm.codeSuffixEnd = '' this.$message.error('后缀范围请输入整数类型')
this.codeForm.codeSuffixStart = ''
} }
}, },
changeSuffixEnd() { changeSuffixEnd() {
if (!this.codeForm.codeSuffixStart) { if (!this.codeForm.codeSuffixStart) {
this.$message.error('请输入后缀范围起始值') this.$message.error('请输入后缀范围起始值')
this.codeForm.codeSuffixEnd = '' this.codeForm.codeSuffixEnd = ''
} else if (isNaN(this.codeForm.codeSuffixEnd)) { } else if (isNaN(this.codeForm.codeSuffixEnd) || this.codeForm.codeSuffixEnd.includes('.')) {
this.$message.error('后缀范围请输入类型') this.$message.error('后缀范围请输入数类型')
this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixEnd =
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
} else { } else {
@ -1185,7 +1196,7 @@ export default {
this.title = '数量盘点入库' this.title = '数量盘点入库'
this.resetCodeForm() this.resetCodeForm()
this.getUnitData() this.getUnitData()
this.GetDeviceTypeTree() this.GetDeviceTypeTree(this.isNumCheck)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['codeForm'].clearValidate() this.$refs['codeForm'].clearValidate()
}) })
@ -1199,7 +1210,7 @@ export default {
this.title = '编码盘点入库' this.title = '编码盘点入库'
this.resetCodeForm() this.resetCodeForm()
this.getUnitData() this.getUnitData()
this.GetDeviceTypeTree() this.GetDeviceTypeTree(this.isNumCheck)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['codeForm'].clearValidate() this.$refs['codeForm'].clearValidate()
}) })
@ -1252,9 +1263,18 @@ export default {
this.getList() this.getList()
}) })
} else { } else {
// this.codeTableList maCode,
this.requiredMaCode = this.codeTableList.some( this.requiredMaCode = this.codeTableList.some(
(item) => !item.maCode, (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) { if (this.requiredMaCode) {
this.$message.error('设备编码不能为空') this.$message.error('设备编码不能为空')
return return
@ -1389,14 +1409,31 @@ export default {
}) })
}, },
// //
async GetDeviceTypeTree() { async GetDeviceTypeTree(type) {
const params = { const params = {
level: 4, level: 4,
} }
const res = await getDeviceTypeTree(params) 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 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) { deviceTypeChange(val) {
console.log('🚀 ~ deviceTypeChange ~ val:', val) console.log('🚀 ~ deviceTypeChange ~ val:', val)
@ -1518,7 +1555,7 @@ export default {
* ----------------------------------------------------------------------------------------------------------------------------- * -----------------------------------------------------------------------------------------------------------------------------
*/ */
/* 查看详情 */ /* 查看详情 */
async queryDetails(row) { queryDetails(row) {
this.sendParams.kindName = row.kindName this.sendParams.kindName = row.kindName
this.dialogConfig.outerVisible = true this.dialogConfig.outerVisible = true
}, },