|
|
|
|
@ -1,12 +1,14 @@ |
|
|
|
|
<template> |
|
|
|
|
<el-dialog title="处理" append-to-body :modelValue="openShow" width="70%" @close="closeDialog"> |
|
|
|
|
<!-- 单个 Form 包裹整个表格 --> |
|
|
|
|
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px"> |
|
|
|
|
<el-form-item label="备注:" label-width="60px"> |
|
|
|
|
<el-input v-model="form.fillMemo" type="textarea" :rows="3" style="width:50%" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<div style="margin-bottom: 12px" v-if="moldAddMore"> |
|
|
|
|
<el-button type="primary" @click="addTable">插入一行</el-button> |
|
|
|
|
<el-button type="danger" @click="delTable">删除选中行</el-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- 单个 Form 包裹整个表格 --> |
|
|
|
|
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px"> |
|
|
|
|
<!-- 全局错误提示 --> |
|
|
|
|
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px"> |
|
|
|
|
{{ formError }} |
|
|
|
|
@ -129,9 +131,8 @@ export default { |
|
|
|
|
addTable() { |
|
|
|
|
this.form.tableData.push({ |
|
|
|
|
_select: false, // 选择状态 |
|
|
|
|
wcId: '', // 作业中心ID |
|
|
|
|
batchNo: '', // 槽号/检查项 |
|
|
|
|
preserveContent: '', // 维护内容 |
|
|
|
|
matter: '', |
|
|
|
|
process: '', |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
@ -154,7 +155,7 @@ export default { |
|
|
|
|
this.formError = ''; |
|
|
|
|
|
|
|
|
|
// 调用单个 Form 的校验方法 |
|
|
|
|
this.$refs.tableForm.validate((isValid, invalidFields) => { |
|
|
|
|
this.$refs.tableForm.validate(async (isValid, invalidFields) => { |
|
|
|
|
if (!isValid) { |
|
|
|
|
// 校验失败:显示提示并滚动到第一个错误字段 |
|
|
|
|
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
|
|
|
|
@ -177,22 +178,25 @@ export default { |
|
|
|
|
|
|
|
|
|
// 调用接口提交(实际项目替换) |
|
|
|
|
try { |
|
|
|
|
// const res = await submitBatchData(submitData); |
|
|
|
|
// if (res.code === 200) { |
|
|
|
|
// this.$message.success('提交成功'); |
|
|
|
|
// this.closeDialog(); |
|
|
|
|
// this.$emit('submitSuccess', submitData); |
|
|
|
|
// } else { |
|
|
|
|
// this.$message.error(res.msg || '提交失败'); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// 演示用 |
|
|
|
|
let query = { |
|
|
|
|
fillingDetailList: submitData, |
|
|
|
|
tbId: this.rowData.id, |
|
|
|
|
deleteIds: [], |
|
|
|
|
fillMemo: '', |
|
|
|
|
}; |
|
|
|
|
submitBatchData(query).then(res => { |
|
|
|
|
this.$message.success('提交成功'); |
|
|
|
|
this.closeDialog(); |
|
|
|
|
this.$emit('submitSuccess', submitData); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 演示用 |
|
|
|
|
// this.$message.success('提交成功'); |
|
|
|
|
// this.closeDialog(); |
|
|
|
|
// this.$emit('submitSuccess', submitData); |
|
|
|
|
} catch (err) { |
|
|
|
|
this.$message.error('网络错误,请稍后重试'); |
|
|
|
|
console.error('提交失败:', err); |
|
|
|
|
this.$message.error(err); |
|
|
|
|
// console.error('提交失败:', err); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|