| | |
| | | </div> |
| | | |
| | | <div class="end-btn" style="margin-top: 38px"> |
| | | <el-button type="primary" @click="addData">发送</el-button> |
| | | <el-button type="default" @click="saveData">存草稿</el-button> |
| | | <el-button type="primary" @click="addData" :loading="sendLoading">发送</el-button> |
| | | <el-button type="default" @click="saveData" :loading="saveLoading">存草稿</el-button> |
| | | </div> |
| | | </el-form> |
| | | </Card> |
| | |
| | | } |
| | | ], |
| | | selectedMember: null, // 存储选中的菌种实验员 |
| | | sendLoading: false, // 发送按钮 loading |
| | | saveLoading: false, // 保存按钮 loading |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | methods: { |
| | | addData() { |
| | | if (this.sendLoading) return; |
| | | this.sendLoading = true; |
| | | console.log('qeqweqeqwqrew', this.form, this.projectData); |
| | | |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!valid) { this.sendLoading = false; return; } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | |
| | | |
| | | if (this.$refs.materialEditor.getContent() == '<p></p>') { |
| | | this.$message.error('请输入报告正文') |
| | | this.sendLoading = false; |
| | | return |
| | | } |
| | | if (!this.projectData.length) { |
| | | this.$message.warning('请选择项目组'); |
| | | this.sendLoading = false; |
| | | return; |
| | | } |
| | | if (!this.selectedMember || !this.selectedMember[0]) { |
| | | this.$message.warning('请选择菌种实验员'); |
| | | this.sendLoading = false; |
| | | return; |
| | | } |
| | | const params = { |
| | |
| | | console.log('params', params); |
| | | |
| | | if (this.$route.query.id) { |
| | | |
| | | params.id = this.$route.query.id |
| | | update(params).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('编辑成功'); |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.msg || '编辑失败'); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.error('编辑失败'); |
| | | }).finally(() => { |
| | | this.sendLoading = false; |
| | | }); |
| | | return |
| | | } |
| | | |
| | |
| | | if (res.code == 200) { |
| | | this.$message.success('发送成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryThree'); |
| | | } else { |
| | | this.$message.error(res.msg || '发送失败'); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.error('发送失败'); |
| | | }).finally(() => { |
| | | this.sendLoading = false; |
| | | }); |
| | | }); |
| | | }, |
| | | saveData() { |
| | | if (this.saveLoading) return; |
| | | this.saveLoading = true; |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!valid) { this.saveLoading = false; return; } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功'); |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.msg || '保存失败'); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.error('保存失败'); |
| | | }).finally(() => { |
| | | this.saveLoading = false; |
| | | }); |
| | | } catch (e) { |
| | | this.$message.error('保存失败'); |
| | | this.saveLoading = false; |
| | | } |
| | | }); |
| | | }, getProjectData(data) { |