优化检验时间选择

This commit is contained in:
binbin_pan 2024-06-12 14:49:59 +08:00
parent 079b106148
commit 8edeace992
2 changed files with 27 additions and 4 deletions

View File

@ -16,7 +16,7 @@ export const dialogConfig = {
{ t_width: '', t_props: 'typeName', t_label: '设备类型' }, { t_width: '', t_props: 'typeName', t_label: '设备类型' },
{ t_width: '', t_props: 'typeModelName', t_label: '规格型号' }, { t_width: '', t_props: 'typeModelName', t_label: '规格型号' },
{ t_width: '', t_props: 'maCode', t_label: '设备编码' }, { t_width: '', t_props: 'maCode', t_label: '设备编码' },
{ t_width: '', t_props: 'num', t_label: '设备数量' }, { t_width: '', t_props: 'num', t_label: '入库数量' },
{ t_width: '', t_props: 'modelName', t_label: '入库人' }, { t_width: '', t_props: 'modelName', t_label: '入库人' },
{ t_width: '', t_props: 'createDate', t_label: '入库日期' }, { t_width: '', t_props: 'createDate', t_label: '入库日期' },
{ t_width: '', t_props: 'remark', t_label: '备注' }, { t_width: '', t_props: 'remark', t_label: '备注' },

View File

@ -354,9 +354,11 @@
:picker-options="{ :picker-options="{
disabledDate(time) { disabledDate(time) {
if (codeForm.thisCheckTime) { if (codeForm.thisCheckTime) {
return time.getTime() < new Date(codeForm.thisCheckTime).getTime(); let today = new Date()
today.setHours(0, 0, 0, 0)
return time.getTime() < today.getTime() || time.getTime() < new Date(codeForm.thisCheckTime).getTime()
} }
return false; return false
} }
}" }"
/> />
@ -602,6 +604,7 @@
type="date" type="date"
placeholder="请输入检验时间" placeholder="请输入检验时间"
style="width: 170px" style="width: 170px"
@change="changeCheckTimeRow(row)"
></el-date-picker> ></el-date-picker>
</template> </template>
</el-table-column> </el-table-column>
@ -617,6 +620,17 @@
type="date" type="date"
placeholder="请输入下次检验时间" placeholder="请输入下次检验时间"
style="width: 170px" style="width: 170px"
:disabled="!row.thisCheckTime"
:picker-options="{
disabledDate(time) {
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 false
}
}"
></el-date-picker> ></el-date-picker>
</template> </template>
</el-table-column> </el-table-column>
@ -1521,12 +1535,21 @@ export default {
}, },
// //
changeCheckTime() { changeCheckTime() {
if (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('下次检验日期不能早于检验日期!')
} else if (!this.codeForm.thisCheckTime) { } else if (!this.codeForm.thisCheckTime) {
this.codeForm.nextCheckTime = '' this.codeForm.nextCheckTime = ''
} }
}, },
changeCheckTimeRow(row) {
if (row.nextCheckTime && row.thisCheckTime > row.nextCheckTime) {
row.nextCheckTime = ''
this.$message.warning('下次检验日期不能早于检验日期!')
} else if (!row.thisCheckTime) {
row.nextCheckTime = ''
}
},
}, },
} }
</script> </script>