| | |
| | | <view class="dialog-header"> |
| | | <text class="dialog-title">{{ operationType === 'add' ? '新增检测项目' : '修改检测项目' }}</text> |
| | | </view> |
| | | <up-form :model="form" ref="formRef" label-width="100" label-position="top"> |
| | | <up-form :model="form" :rules="rules" ref="formRef" label-width="100" label-position="top"> |
| | | <up-form-item label="检测项目" prop="name" required borderBottom> |
| | | <up-input v-model="form.name" placeholder="请输入检测项目名称" border="surround" /> |
| | | </up-form-item> |
| | |
| | | dialogVisible.value = false; |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | formRef.value.validate().then(res => { |
| | | submitLoading.value = true; |
| | | qualityInspectItemSave(form).then(() => { |
| | | const submitForm = async () => { |
| | | if (!formRef.value) return |
| | | const valid = await formRef.value.validate().catch(() => false) |
| | | if (!valid) return |
| | | submitLoading.value = true; |
| | | qualityInspectItemSave(form) |
| | | .then(() => { |
| | | toast(operationType.value === 'add' ? '新增成功' : '修改成功'); |
| | | dialogVisible.value = false; |
| | | handleQuery(); |
| | | }).finally(() => { |
| | | }) |
| | | .finally(() => { |
| | | submitLoading.value = false; |
| | | }); |
| | | }).catch(errors => { |
| | | console.log('验证失败', errors); |
| | | }); |
| | | }; |
| | | |
| | | const handleDelete = (row) => { |
| | | showConfirm('确认删除该检测项目吗?').then(res => { |
| | | if (res.confirm) { |
| | | qualityInspectItemDelete({ id: row.id }).then(() => { |
| | | // 对齐 PC 端:删除接口接收 id 数组 |
| | | qualityInspectItemDelete([row.id]).then(() => { |
| | | toast('删除成功'); |
| | | handleQuery(); |
| | | }); |