代码优化
This commit is contained in:
parent
e1a821457c
commit
b83382b9f2
|
|
@ -68,7 +68,7 @@
|
|||
"
|
||||
/>
|
||||
<el-table-column label="入库来源" align="center" prop="putInType" />
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
label="工程名称"
|
||||
align="center"
|
||||
prop="projectName"
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
align="center"
|
||||
prop="unitName"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
/> -->
|
||||
<el-table-column
|
||||
label="单号"
|
||||
align="center"
|
||||
|
|
@ -360,10 +360,17 @@
|
|||
if (codeForm.thisCheckTime) {
|
||||
let today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return time.getTime() < today.getTime() || time.getTime() < new Date(codeForm.thisCheckTime).getTime()
|
||||
return (
|
||||
time.getTime() <
|
||||
today.getTime() ||
|
||||
time.getTime() <
|
||||
new Date(
|
||||
codeForm.thisCheckTime,
|
||||
).getTime()
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
|
@ -552,7 +559,7 @@
|
|||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<span style="color: red;">* </span>设备编码
|
||||
<span style="color: red">* </span>设备编码
|
||||
</template>
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-input
|
||||
|
|
@ -633,10 +640,16 @@
|
|||
if (row.thisCheckTime) {
|
||||
let today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return time.getTime() < today.getTime() || time.getTime() < new Date(row.thisCheckTime).getTime()
|
||||
return (
|
||||
time.getTime() < today.getTime() ||
|
||||
time.getTime() <
|
||||
new Date(
|
||||
row.thisCheckTime,
|
||||
).getTime()
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
}"
|
||||
></el-date-picker>
|
||||
</template>
|
||||
|
|
@ -1147,7 +1160,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 +1172,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 +1434,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 +1594,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 +1626,4 @@ export default {
|
|||
::v-deep .el-input-number.is-without-controls .el-input__inner {
|
||||
text-align: start;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue