代码优化

This commit is contained in:
BianLzhaoMin 2024-08-23 17:33:09 +08:00
parent e1a821457c
commit b83382b9f2
1 changed files with 43 additions and 17 deletions

View File

@ -68,7 +68,7 @@
" "
/> />
<el-table-column label="入库来源" align="center" prop="putInType" /> <el-table-column label="入库来源" align="center" prop="putInType" />
<el-table-column <!-- <el-table-column
label="工程名称" label="工程名称"
align="center" align="center"
prop="projectName" prop="projectName"
@ -79,7 +79,7 @@
align="center" align="center"
prop="unitName" prop="unitName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> /> -->
<el-table-column <el-table-column
label="单号" label="单号"
align="center" align="center"
@ -360,10 +360,17 @@
if (codeForm.thisCheckTime) { if (codeForm.thisCheckTime) {
let today = new Date() let today = new Date()
today.setHours(0, 0, 0, 0) 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 return false
} },
}" }"
/> />
</el-form-item> </el-form-item>
@ -552,7 +559,7 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
> >
<template v-slot:header> <template v-slot:header>
<span style="color: red;">* </span>设备编码 <span style="color: red">* </span>设备编码
</template> </template>
<template v-slot:default="{ row }" v-if="!isNumCheck"> <template v-slot:default="{ row }" v-if="!isNumCheck">
<el-input <el-input
@ -633,10 +640,16 @@
if (row.thisCheckTime) { if (row.thisCheckTime) {
let today = new Date() let today = new Date()
today.setHours(0, 0, 0, 0) 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 return false
} },
}" }"
></el-date-picker> ></el-date-picker>
</template> </template>
@ -1147,7 +1160,10 @@ export default {
this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart =
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') 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.$message.error('后缀范围请输入整数类型')
this.codeForm.codeSuffixStart = '' this.codeForm.codeSuffixStart = ''
} }
@ -1156,7 +1172,10 @@ export default {
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) || this.codeForm.codeSuffixEnd.includes('.')) { } 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, '')
@ -1415,24 +1434,28 @@ export default {
} }
const res = await getDeviceTypeTree(params) const res = await getDeviceTypeTree(params)
if (type) { if (type) {
this.disableNodes(res.data, '1'); this.disableNodes(res.data, '1')
} else { } else {
this.disableNodes(res.data, '0'); this.disableNodes(res.data, '0')
} }
this.deviceTypeTree = res.data this.deviceTypeTree = res.data
}, },
// //
disableNodes(nodes, manageType, level = 1) { disableNodes(nodes, manageType, level = 1) {
nodes.forEach(node => { nodes.forEach((node) => {
node.level = level node.level = level
if (node.children) { if (node.children) {
this.disableNodes(node.children, manageType, level + 1); this.disableNodes(node.children, manageType, level + 1)
} else if (!node.children && node.level < 4) { } else if (!node.children && node.level < 4) {
node.disabled = true 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 node.disabled = true
} }
}); })
}, },
/////// ///////
deviceTypeChange(val) { deviceTypeChange(val) {
@ -1571,7 +1594,10 @@ export default {
}, },
// //
changeCheckTime() { 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.codeForm.nextCheckTime = ''
this.$message.warning('下次检验日期不能早于检验日期!') this.$message.warning('下次检验日期不能早于检验日期!')
} else if (!this.codeForm.thisCheckTime) { } else if (!this.codeForm.thisCheckTime) {