Commit 24e2fd3d authored by shifangwuji's avatar shifangwuji

9/21(3)

parent 79b9cc9b
......@@ -325,10 +325,8 @@ export default {
trigger: 'blur',
},
],
},
pissbList: [],
pgxList: [
{
......@@ -345,23 +343,35 @@ export default {
watch: {
'form.jbcode': {
handler(newJbcode) {
// 当 jbcode 字段发生变化时,解析它并更新相关字段的值
const parts = newJbcode.split(',')
this.form.ptype = parts[0] || ''
this.form.jbrank = parts[1] || ''
this.form.jblot = parts[2] || ''
if (newJbcode) { // 检查是否为空或未定义
const parts = newJbcode.split(',');
this.form.ptype = parts[0] || '';
this.form.jbrank = parts[1] || '';
this.form.jblot = parts[2] || '';
} else {
// 如果 newJbcode 为空,可以选择在这里重置相关字段
this.form.ptype = '';
this.form.jbrank = '';
this.form.jblot = '';
}
},
immediate: true // 立即执行一次以处理初始值
immediate: true
},
'form.jlcod': {
handler(newJlcod) {
// 当 jlcod 字段发生变化时,解析它并更新相关字段的值
const parts = newJlcod.split(',')
this.form.jlname = parts[0] || ''
this.form.jllot = parts[1] || ''
this.form.jlvalidDate = parts[2] || ''
if (newJlcod) { // 检查是否为空或未定义
const parts = newJlcod.split(',');
this.form.jlname = parts[0] || '';
this.form.jllot = parts[1] || '';
this.form.jlvalidDate = parts[2] || '';
} else {
// 如果 newJlcod 为空,可以选择在这里重置相关字段
this.form.jlname = '';
this.form.jllot = '';
this.form.jlvalidDate = '';
}
},
immediate: true // 立即执行一次以处理初始值
immediate: true
}
},
mounted() {
......@@ -384,10 +394,17 @@ export default {
},
methods: {
validateField(value, callback, fieldName) {
if (this[fieldName + 'Enabled'] && !value.trim()) {
callback(new Error(fieldName + '不能为空'));
if (this[fieldName + 'Enabled']) { // 检查是否开启验证
if (value) { // 检查是否为空或未定义
value = value.trim(); // 去掉前导和尾随空格
}
if (!value) {
callback(new Error(fieldName + '不能为空'));
} else {
callback();
}
} else {
callback();
callback(); // 如果验证未开启,直接通过
}
},
handlePgxChange() {
......@@ -490,10 +507,12 @@ export default {
this.form.jlcod = ''
this.form.unlockUsername = ''
// 显示成功提示
MessageBox.alert('解锁成功', '成功', {
confirmButtonText: '确定',
type: 'success'
})
this.$message({
showClose: true,
message: '解锁成功',
type: 'success',
duration: 5000,
});
} else {
// 解锁失败,显示解锁失败的弹出框
MessageBox.alert(response.data.message, '解锁失败', {
......@@ -529,9 +548,15 @@ export default {
this.wblotEnabled = false
this.jlcodEnabled = false
this.lockUserEnabled = false
// 手动重置错误信息
this.$refs.form.clearValidate(); // 清空表单验证信息
this.$nextTick(() => {
this.$refs.form.resetFields(); // 重置表单字段
});
sessionStorage.setItem('applicationForm', JSON.stringify(this.form))
},
handelTab(i, e) {
handleTab(i, e) {
const that = this
if (!that.$refs['input' + i]) {
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment