Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory
| | |
| | | </div> |
| | | </div> |
| | | <div class="add-project-footer"> |
| | | <el-button @click="submitForm" type="primary">保存</el-button> |
| | | <el-button @click="submitForm" type="primary" :loading="loading" :disabled="loading">保存</el-button> |
| | | </div> |
| | | </template> |
| | | <SelectMember ref="selectMember" @submit="selectUser" /> |
| | |
| | | 1: { key: 'approver', limit: 1, label: '菌种审批人' }, |
| | | 2: { key: 'engineer', limit: 1, label: '菌种工程师' }, |
| | | }, |
| | | loading: false, |
| | | } |
| | | }, |
| | | methods: { |
| | | submitForm() { |
| | | if (this.loading) return; // 防止重复提交 |
| | | this.loading = true; |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | const requiredRoles = ['菌种审批人', '菌种工程师', '菌种实验员']; |
| | |
| | | for (const role of requiredRoles) { |
| | | if (!selectedRoleNames.includes(role)) { |
| | | this.$message.error(`请选择${role}`); |
| | | this.loading = false; |
| | | return; |
| | | } |
| | | } |
| | | if (this.selectMemberData.length == 0) { |
| | | this.$message.error('请选择项目组成员'); |
| | | this.loading = false; |
| | | return; |
| | | } |
| | | const ROLE_NAME_TO_TYPE = { |
| | |
| | | })) |
| | | } |
| | | addProject(data).then(res => { |
| | | this.loading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('添加成功'); |
| | | this.resetForm(); // 添加成功后重置表单 |
| | | this.$router.back(); // 跳转到上一个页面 |
| | | // Optionally, navigate away or give other feedback |
| | | // this.$router.push({ name: 'ProjectList' }); |
| | | } |
| | | }).catch(() => { |
| | | this.loading = false; // 失败时也关闭 loading |
| | | }) |
| | | } else { |
| | | this.loading = false; |
| | | } |
| | | }) |
| | | }, |
| | |
| | | </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="submitLoading" :disabled="submitLoading">发送</el-button> |
| | | <el-button type="default" @click="saveData" :loading="submitLoading" :disabled="submitLoading">存草稿</el-button> |
| | | </div> |
| | | </el-form> |
| | | </Card> |
| | | <chooseProject @submit="getProjectData" :show="showChoose" @close="showChoose = false"></chooseProject> |
| | | <SelectMember :projectId="projectData.length&&projectData[0].id" title="选择菌种实验员" ref="selectMember" @submit="selectUser" :singleSelect="true" /> |
| | | <chooseProject @submit="getProjectData" :show="showChoose" @close="showChoose = false"></chooseProject> |
| | | <SelectMember :projectId="projectData.length && projectData[0].id" title="选择菌种实验员" ref="selectMember" |
| | | @submit="selectUser" :singleSelect="true" /> |
| | | </div> |
| | | |
| | | </template> |
| | |
| | | import AiEditor from '@/components/AiEditor' |
| | | import ChooseProject from '@/components/chooseProject/index.vue' |
| | | import SelectMember from '@/components/SelectMember' |
| | | import { add,getDetail,update } from './service' |
| | | import { add, getDetail, update } from './service' |
| | | |
| | | export default { |
| | | components: { AiEditor, ChooseProject, SelectMember }, |
| | |
| | | showChoose: false, |
| | | radio1: 1, |
| | | rules: { |
| | | |
| | | |
| | | reportName: [ |
| | | { required: true, message: '请输入报告名称', trigger: 'blur' } |
| | | ] |
| | |
| | | } |
| | | ], |
| | | selectedMember: null, // 存储选中的菌种实验员 |
| | | submitLoading: false // 提交 loading 状态 |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.$nextTick(() => { |
| | | window.scrollTo(0, 0); |
| | | }); |
| | | |
| | | |
| | | if (this.$route.query.id) { |
| | | getDetail(this.$route.query.id).then(res => { |
| | | const data = res.data || res; |
| | | console.log('qweqweqweq',data); |
| | | |
| | | console.log('qweqweqweq', data); |
| | | |
| | | this.form = { |
| | | ...this.form, |
| | | ...data, |
| | |
| | | }) |
| | | |
| | | this.selectedMember = [{ |
| | | nickName:data.experimentName, |
| | | userId:data.experimentId |
| | | nickName: data.experimentName, |
| | | userId: data.experimentId |
| | | }] |
| | | |
| | | this.projectData = data.projectTeam ? |
| | | [{ ...data.projectTeam, staffName: data.projectTeam.staff || '' }] : |
| | | []; |
| | | |
| | | console.log('qwe45645664',this.tableData); |
| | | |
| | | console.log('qwe45645664', this.tableData); |
| | | |
| | | |
| | | |
| | | }).catch(err => { |
| | |
| | | }, |
| | | methods: { |
| | | addData() { |
| | | if (this.submitLoading) return; |
| | | this.submitLoading = true; |
| | | console.log('qeqweqeqwqrew', this.form, this.projectData); |
| | | |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!valid) { this.submitLoading = false; return; } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | |
| | | |
| | | if (this.$refs.materialEditor.getContent() == '<p></p>') { |
| | | this.$message.error('请输入报告正文') |
| | | this.submitLoading = false; |
| | | return |
| | | } |
| | | if (!this.projectData.length) { |
| | | this.$message.warning('请选择项目组'); |
| | | this.submitLoading = false; |
| | | return; |
| | | } |
| | | if (!this.selectedMember || !this.selectedMember[0]) { |
| | | this.$message.warning('请选择菌种实验员'); |
| | | this.submitLoading = false; |
| | | return; |
| | | } |
| | | const params = { |
| | |
| | | if (this.$route.query.id) { |
| | | params.id = this.$route.query.id |
| | | update(params).then(res => { |
| | | this.submitLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('编辑成功'); |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.msg || '编辑失败'); |
| | | this.submitLoading = false; |
| | | } |
| | | }) |
| | | }).catch(() => { this.submitLoading = false; }) |
| | | return |
| | | } |
| | | |
| | | add(params).then(res => { |
| | | this.submitLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('发送成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryOne'); |
| | | } else { |
| | | this.$message.error(res.msg || '发送失败'); |
| | | this.submitLoading = false; |
| | | } |
| | | }) |
| | | }).catch(() => { this.submitLoading = false; }) |
| | | }); |
| | | }, |
| | | saveData() { |
| | | if (this.submitLoading) return; |
| | | this.submitLoading = true; |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!valid) { this.submitLoading = false; return; } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | | }) |
| | | |
| | | const params = { |
| | | isDraft: 1, |
| | | projectId: this.projectData[0].id, |
| | | experimentId: this.selectedMember[0].userId, |
| | | // reportCode: this.form.reportCode, |
| | | reportContent: this.$refs.materialEditor.getContent(), |
| | | reportName: this.form.reportName, |
| | | evaluateTotal: this.totalScore, |
| | | evaluate: str.join(','), |
| | | reportType: 1 |
| | | }; |
| | | add(params).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryOne'); |
| | | } |
| | | }) |
| | | const params = { |
| | | isDraft: 1, |
| | | projectId: this.projectData[0].id, |
| | | experimentId: this.selectedMember[0].userId, |
| | | // reportCode: this.form.reportCode, |
| | | reportContent: this.$refs.materialEditor.getContent(), |
| | | reportName: this.form.reportName, |
| | | evaluateTotal: this.totalScore, |
| | | evaluate: str.join(','), |
| | | reportType: 1 |
| | | }; |
| | | add(params).then(res => { |
| | | this.submitLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryOne'); |
| | | } else { |
| | | this.$message.error(res.msg || '保存失败'); |
| | | this.submitLoading = false; |
| | | } |
| | | }).catch(() => { this.submitLoading = false; }) |
| | | }); |
| | | }, getProjectData(data) { |
| | | }, |
| | | getProjectData(data) { |
| | | this.projectData = [data]; // 将选中的项目组数据存储到数组中 |
| | | |
| | | |
| | | this.showChoose = false |
| | | }, |
| | | selectUser(data) { |
| | |
| | | </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="submitLoading">发送</el-button> |
| | | <el-button type="default" @click="saveData" :loading="draftLoading">存草稿</el-button> |
| | | </div> |
| | | </el-form> |
| | | </Card> |
| | |
| | | } |
| | | ], |
| | | selectedMember: null, // 存储选中的菌种实验员 |
| | | submitLoading: false, // 发送按钮loading |
| | | draftLoading: false, // 存草稿按钮loading |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | addData() { |
| | | console.log('qeqweqeqwqrew', this.form, this.projectData); |
| | | |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | | }) |
| | | |
| | | if (this.$refs.materialEditor.getContent() == '<p></p>') { |
| | | this.$message.error('请输入报告正文') |
| | | return |
| | | } |
| | | if (!this.projectData.length) { |
| | | this.$message.warning('请选择项目组'); |
| | | return; |
| | | } |
| | | if (!this.selectedMember || !this.selectedMember[0]) { |
| | | this.$message.warning('请选择菌种实验员'); |
| | | return; |
| | | } |
| | | const params = { |
| | | isDraft: 0, |
| | | projectId: this.projectData[0].id, |
| | | experimentId: this.selectedMember[0].userId, |
| | | // reportCode: this.form.reportCode, |
| | | reportContent: this.$refs.materialEditor.getContent(), |
| | | reportName: this.form.reportName, |
| | | evaluateTotal: this.totalScore, |
| | | evaluate: str.join(','), |
| | | reportType: 4 |
| | | }; |
| | | 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() |
| | | } |
| | | async addData() { |
| | | if (this.submitLoading) return; |
| | | this.submitLoading = true; |
| | | try { |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) { this.submitLoading = false; return; } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | | }) |
| | | return |
| | | } |
| | | |
| | | add(params).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('发送成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryFour'); |
| | | if (this.$refs.materialEditor.getContent() == '<p></p>') { |
| | | this.$message.error('请输入报告正文') |
| | | this.submitLoading = false; |
| | | return |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | saveData() { |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | | }) |
| | | |
| | | try { |
| | | if (!this.projectData.length) { |
| | | this.$message.warning('请选择项目组'); |
| | | this.submitLoading = false; |
| | | return; |
| | | } |
| | | if (!this.selectedMember || !this.selectedMember[0]) { |
| | | this.$message.warning('请选择菌种实验员'); |
| | | this.submitLoading = false; |
| | | return; |
| | | } |
| | | const params = { |
| | | isDraft: 1, |
| | | isDraft: 0, |
| | | projectId: this.projectData[0].id, |
| | | experimentId: this.selectedMember[0].userId, |
| | | // reportCode: this.form.reportCode, |
| | | reportContent: this.$refs.materialEditor.getContent(), |
| | | reportName: this.form.reportName, |
| | | evaluateTotal: this.totalScore, |
| | | evaluate: str.join(','), |
| | | evaluate: str.join(','), |
| | | reportType: 4 |
| | | }; |
| | | if (this.$route.query.id) { |
| | | params.id = this.$route.query.id |
| | | update(params).then(res => { |
| | | this.submitLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('编辑成功'); |
| | | this.$router.back() |
| | | } |
| | | }).catch(() => { |
| | | this.submitLoading = false; |
| | | }) |
| | | return |
| | | } |
| | | add(params).then(res => { |
| | | this.submitLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功'); |
| | | this.$message.success('发送成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryFour'); |
| | | } |
| | | }).catch(() => { |
| | | this.submitLoading = false; |
| | | }) |
| | | } catch (e) { |
| | | this.$message.error('保存失败'); |
| | | } |
| | | }); |
| | | }, getProjectData(data) { |
| | | }); |
| | | } catch (e) { |
| | | this.submitLoading = false; |
| | | } |
| | | }, |
| | | async saveData() { |
| | | if (this.draftLoading) return; |
| | | this.draftLoading = true; |
| | | try { |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) { this.draftLoading = false; return; } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | | }) |
| | | try { |
| | | const params = { |
| | | isDraft: 1, |
| | | projectId: this.projectData[0].id, |
| | | experimentId: this.selectedMember[0].userId, |
| | | // reportCode: this.form.reportCode, |
| | | reportContent: this.$refs.materialEditor.getContent(), |
| | | reportName: this.form.reportName, |
| | | evaluateTotal: this.totalScore, |
| | | evaluate: str.join(','), |
| | | reportType: 4 |
| | | }; |
| | | add(params).then(res => { |
| | | this.draftLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功'); |
| | | this.$router.push('/strainReportLibrary/reportLibraryFour'); |
| | | } |
| | | }).catch(() => { |
| | | this.draftLoading = false; |
| | | }) |
| | | } catch (e) { |
| | | this.draftLoading = false; |
| | | this.$message.error('保存失败'); |
| | | } |
| | | }); |
| | | } catch (e) { |
| | | this.draftLoading = false; |
| | | this.$message.error('保存失败'); |
| | | } |
| | | }, |
| | | getProjectData(data) { |
| | | this.projectData = [data]; // 将选中的项目组数据存储到数组中 |
| | | this.showChoose = false |
| | | }, |
| | |
| | | </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="loading" :disabled="loading">发送</el-button> |
| | | <el-button type="default" @click="saveData" :loading="loading" :disabled="loading">存草稿</el-button> |
| | | </div> |
| | | </el-form> |
| | | </Card> |
| | |
| | | } |
| | | ], |
| | | selectedMember: null, // 存储选中的菌种实验员 |
| | | loading: false, // 提交loading状态 |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | methods: { |
| | | addData() { |
| | | console.log('qeqweqeqwqrew', this.form, this.projectData); |
| | | |
| | | if (this.loading) return; |
| | | this.loading = true; |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!valid) { |
| | | this.loading = false; |
| | | return; |
| | | } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | |
| | | |
| | | if (this.$refs.materialEditor.getContent() == '<p></p>') { |
| | | this.$message.error('请输入报告正文') |
| | | this.loading = false; |
| | | return |
| | | } |
| | | if (!this.projectData.length) { |
| | | this.$message.warning('请选择项目组'); |
| | | this.loading = false; |
| | | return; |
| | | } |
| | | if (!this.selectedMember || !this.selectedMember[0]) { |
| | | this.$message.warning('请选择菌种实验员'); |
| | | this.loading = false; |
| | | return; |
| | | } |
| | | const params = { |
| | |
| | | if (this.$route.query.id) { |
| | | params.id = this.$route.query.id |
| | | update(params).then(res => { |
| | | this.loading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('编辑成功'); |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.message || '编辑失败'); |
| | | } |
| | | }).catch(() => { |
| | | this.loading = false; |
| | | this.$message.error('编辑失败'); |
| | | }) |
| | | return |
| | | } |
| | | |
| | | add(params).then(res => { |
| | | this.loading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('发送成功'); |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.message || '发送失败'); |
| | | } |
| | | }).catch(() => { |
| | | this.loading = false; |
| | | this.$message.error('发送失败'); |
| | | }) |
| | | }); |
| | | }, |
| | | saveData() { |
| | | if (this.loading) return; |
| | | this.loading = true; |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!valid) { |
| | | this.loading = false; |
| | | return; |
| | | } |
| | | let str = [] |
| | | str = this.assessmentTable.map(item => { |
| | | return item.selectedScore |
| | |
| | | reportType: 2 |
| | | }; |
| | | add(params).then(res => { |
| | | this.loading = false; |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功'); |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.message || '保存失败'); |
| | | } |
| | | }).catch(() => { |
| | | this.loading = false; |
| | | this.$message.error('保存失败'); |
| | | }) |
| | | } catch (e) { |
| | | this.loading = false; |
| | | this.$message.error('保存失败'); |
| | | } |
| | | }); |
| | |
| | | </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) { |