| | |
| | | <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="120px" label-position="right"> |
| | | <el-form-item label="场所:" prop="laboratoryId"> |
| | | <el-select v-model="editForm.laboratoryId" clearable placeholder="请选择" size="small" style="width: 100%"> |
| | | <el-option v-for="item in laboratoryList" :key="item.label" :label="item.label" :value="item.label"></el-option> |
| | | <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="检验对象:" prop="specimenName"> |
| | |
| | | editFormDia: false, |
| | | editLoad: false, |
| | | editForm: { |
| | | id: '', |
| | | laboratoryId: '', // 场所 |
| | | specimenName: '', // 检验对象 |
| | | specimenNameEn: '', // 检验对象EN |
| | |
| | | this.obtainItemParameterList() |
| | | this.editFormDia = true |
| | | if (type === 'add') { |
| | | this.$refs.editForm.resetFields() |
| | | this.resetForm("editForm"); |
| | | } else { |
| | | this.editForm = this.HaveJson(row) |
| | | this.editForm = {...row} |
| | | } |
| | | }, |
| | | // 提交编辑 |
| | |
| | | this.$refs.editForm.validate(valid => { |
| | | if (valid) { |
| | | this.editLoad = true |
| | | let obj = this.HaveJson(this.editForm) |
| | | if(obj.id){ |
| | | if(this.editForm.id){ |
| | | // 修改 |
| | | upTestObject(obj).then(res => { |
| | | upTestObject(this.editForm).then(res => { |
| | | this.editLoad = false |
| | | if (res.code === 201) { |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('修改成功') |
| | | this.closeDia() |
| | | this.$emit('refreshList') |
| | | }).catch(e => { |
| | | this.editLoad = false |
| | | this.editFormDia = false |
| | | }) |
| | | }else{ |
| | | // 新增 |
| | | addTestObject(obj).then(res => { |
| | | addTestObject(this.editForm).then(res => { |
| | | this.editLoad = false |
| | | if (res.code === 201) { |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('添加成功') |
| | | this.closeDia() |
| | | this.$emit('refreshList') |
| | | }).catch(e => { |
| | | this.editLoad = false |
| | | this.editFormDia = false |
| | | }) |
| | | } |
| | | } |
| | |
| | | // 关闭弹框 |
| | | closeDia () { |
| | | this.editFormDia = false |
| | | this.$refs.editForm.resetFields() |
| | | this.$parent.refreshTable('page') |
| | | this.resetForm("editForm"); |
| | | }, |
| | | // 获取场所下拉框的值 |
| | | obtainItemParameterList() { |