Commit bad1e7cb authored by shifangwuji's avatar shifangwuji

first

parent a7a34648
......@@ -88,18 +88,18 @@
</el-col>
</el-row>
<!-- 提取 jbtype、jbrank 和 jbLot -->
<!-- 提取 ptype、jbrank 和 jbLot -->
<el-row :gutter="0" style="display: flex; width: 81%;">
<el-col :span="8">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="jbtype:" prop="jbtype">
<template v-if="form.jbtype && form.jbtype.length > 21">
<el-tooltip :content="form.jbtype" effect="dark">
<el-input v-model="form.jbtype" placeholder="jbtype" :disabled="true" style="width: 100%;" />
<el-form-item label="jbtype:" prop="ptype">
<template v-if="form.ptype && form.ptype.length > 21">
<el-tooltip :content="form.ptype" effect="dark">
<el-input v-model="form.ptype" placeholder="ptype" :disabled="true" style="width: 100%;" />
</el-tooltip>
</template>
<template v-else>
<el-input v-model="form.jbtype" placeholder="jbtype" :disabled="true" style="width: 100%;" />
<el-input v-model="form.ptype" placeholder="ptype" :disabled="true" style="width: 100%;" />
</template>
</el-form-item>
</el-form>
......@@ -281,7 +281,7 @@ export default {
gx: '',
machine: '',
jbcode: '',
jbtype: '',
ptype: '',
jbrank: '',
jbLot: '',
jlcod: '',
......@@ -314,7 +314,7 @@ export default {
handler(newJbcode) {
// 当 jbcode 字段发生变化时,解析它并更新相关字段的值
const parts = newJbcode.split(',')
this.form.jbtype = parts[0] || ''
this.form.ptype = parts[0] || ''
this.form.jbrank = parts[1] || ''
this.form.jbLot = parts[2] || ''
},
......@@ -326,31 +326,10 @@ export default {
const parts = newJlcod.split(',')
this.form.jltype = parts[0] || ''
this.form.jllot = parts[1] || ''
// 获取 jlbzqPart
const jlbzqPart = parts[2] || ''
// 检查 jlbzqPart 是否有数据
if (jlbzqPart.trim() !== '') {
// 验证并格式化 jlbzq
const jlbzqRegex = /^\d{4}-\d{2}-\d{2}$/ // 正则表达式用于验证 'yyyy-mm-dd' 格式
if (jlbzqRegex.test(jlbzqPart)) {
this.form.jlbzq = jlbzqPart
} else {
// 如果不符合规范,可以设置一个默认值或者给出错误提示
this.form.jlbzq = '' // 或者设置一个默认值
// 或者显示错误提示
MessageBox.alert('jlcod 中的 jlbzq 不符合规范,请输入有效的日期格式(yyyy-mm-dd)', '错误', {
confirmButtonText: '确定',
type: 'error'
})
}
}
this.form.jlbzq = parts[2] || ''
},
immediate: true // 立即执行一次以处理初始值
}
},
mounted() {
this.$nextTick(() => {
......@@ -426,7 +405,7 @@ export default {
})
}
} else if (response.code === 400) {
} else {
console.log('Setting lockUserEnabled to true');
// 查询失败时,将所有输入框锁定并显示错误提示
this.jbcodeEnabled = false;
......@@ -544,40 +523,82 @@ export default {
}).then(() => {
this.$refs.form.validate((valid) => {
if (valid) {
addApplication(this.form).then(res => {
console.log('res', res)
if (res.code === 200) {
if (res.data !== null) {
if (res.data.ptype === '1') {
this.$message({
showClose: true,
message: '保存成功',
type: 'success',
duration: 5000
})
} else if (res.data.ptype === '2') {
// 验证通过,继续处理 jlbzq 字段
const jlcodParts = this.form.jlcod.split(',')
const jlbzqPart = jlcodParts[2] || ''
if (jlbzqPart.trim() !== '') {
const jlbzqRegex = /^\d{4}-\d{2}-\d{2}$/ // 正则表达式用于验证 'yyyy-mm-dd' 格式
if (jlbzqRegex.test(jlbzqPart)) {
// jlbzq 格式正确,可以继续保存操作
addApplication(this.form).then(res => {
console.log('res', res)
if (res.code === 200) {
if (res.data !== null) {
this.$message({
showClose: true,
message: '保存成功',
type: 'success',
duration: 5000
})
}
this.resetForm()
} else if (res.code === null) {
this.$message({
showClose: true,
message: '保存成功',
type: 'success',
duration: 5000
message: res.message,
type: 'error',
duration: 10000
})
}
}
this.resetFrom()
} else if (res.code === null) {
})
} else {
// jlbzq 格式不正确,显示错误提示
this.$message({
showClose: true,
message: res.message,
message: 'jlcod 中的 jlbzq 不符合规范,请输入有效的日期格式(yyyy-mm-dd)',
type: 'error',
duration: 10000
duration: 5000
})
}
})
} else {
// jlbzqPart 为空,可以继续保存操作
addApplication(this.form).then(res => {
console.log('res', res)
if (res.code === 200) {
if (res.data !== null) {
if (res.data.ptype === '1') {
this.$message({
showClose: true,
message: '保存成功',
type: 'success',
duration: 5000
})
} else if (res.data.ptype === '2') {
this.$message({
showClose: true,
message: '保存成功',
type: 'success',
duration: 5000
})
}
}
this.resetForm()
} else if (res.code === null) {
this.$message({
showClose: true,
message: res.message,
type: 'error',
duration: 10000
})
}
})
}
}
})
})
},
// 调数据字典查询
getDict() {
const obj = {
......
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