| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="preserveTime" label="入库保藏/废弃时间" /> |
| | | <el-table-column label="操作" v-if="[1, 3].includes(roleType) && $route.query.isDetail || (!$route.query.isDetail && [4].includes(roleType))"> |
| | | <el-table-column label="操作" |
| | | v-if="[1, 3].includes(roleType) && $route.query.isDetail&& !scope.row.preserveSignature || (!$route.query.isDetail && [4].includes(roleType))"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleEditInoculation(scope.row, scope.$index)" |
| | | v-if="!$route.query.isDetail && [1, 4].includes(roleType)">编辑</el-button> |
| | | <el-button type="text" @click="handleConfirmStorageClick(scope.row, scope.$index)" |
| | | v-if="$route.query.isDetail && [3].includes(roleType)">确认入库</el-button> |
| | | v-if="$route.query.isDetail && [3].includes(roleType) && !scope.row.preserveSignature">确认入库</el-button> |
| | | <el-button type="text" @click="handleDeleteInoculation(scope.$index)" |
| | | v-if="!$route.query.isDetail && !scope.row.preserveSignature && [1, 4].includes(roleType)">删除</el-button> |
| | | </template> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="preserveTime" label="保藏时间" /> |
| | | <el-table-column label="操作" v-if="[1, 3].includes(roleType) && $route.query.isDetail || (!$route.query.isDetail && [4].includes(roleType))"> |
| | | <el-table-column label="操作" |
| | | v-if="[1, 3].includes(roleType) && $route.query.isDetail&& !scope.row.preserveSignature || (!$route.query.isDetail && [4].includes(roleType))"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleEditPreserve(scope.row, scope.$index)" |
| | | v-if="!$route.query.isDetail && [1, 4].includes(roleType)">编辑</el-button> |
| | | <el-button type="text" @click="handleConfirmPreserve(scope.row, scope.$index)" |
| | | v-if="$route.query.isDetail && [3].includes(roleType)">确认入库</el-button> |
| | | v-if="$route.query.isDetail && [3].includes(roleType) && !scope.row.preserveSignature">确认入库</el-button> |
| | | <el-button type="text" @click="handleDeletePreserve(scope.$index)" |
| | | v-if="!$route.query.isDetail && !scope.row.preserveSignature && [1, 4].includes(roleType)">删除</el-button> |
| | | </template> |
| | |
| | | @confirm="handleConfirmStorage" /> |
| | | <ConfirmPreserveDialog :visible.sync="showConfirmPreserveDialog" :editData="editPreserveData" |
| | | @confirm="handleConfirmPreserveSubmit" /> |
| | | <div class="end-btn" style="margin-top: 20px;" v-if="!$route.query.isDetail&& [3, 4].includes(roleType)"> |
| | | <div class="end-btn" style="margin-top: 20px;" v-if="!$route.query.isDetail && [3, 4].includes(roleType)"> |
| | | <el-button type="primary" @click="handleSubmit(1)">提交</el-button> |
| | | <el-button type="primary" @click="handleSubmit(3)">同步给保藏人</el-button> |
| | | <el-button type="default" @click="handleSubmit(2)">存草稿</el-button> |
| | |
| | | import ConfirmStorageDialog from "./confirm-storage-dialog.vue"; |
| | | import ConfirmPreserveDialog from "./confirm-preserve-dialog.vue"; |
| | | |
| | | import { add, detail, edit } from './service' |
| | | import { add, detail, edit, vaccinationSlopesConfirm, culturePreservationsConfirm } from './service' |
| | | export default { |
| | | components: { |
| | | AiEditor, |
| | |
| | | PreserveStrainRecordDialog, |
| | | ConfirmStorageDialog, |
| | | ConfirmPreserveDialog, |
| | | |
| | | }, |
| | | name: "AddBreedingRecord", |
| | | data() { |
| | |
| | | this.showConfirmStorageDialog = true; |
| | | }, |
| | | handleConfirmStorage(data) { |
| | | // 更新对应行的数据,保留原有数据并更新签名 |
| | | if (this.editInoculationIndex !== null) { |
| | | this.$set(this.form.vaccinationSlopes, this.editInoculationIndex, { |
| | | ...this.form.vaccinationSlopes[this.editInoculationIndex], |
| | | preserveSignature: data.preserveSignature, // 更新签名数据 |
| | | status: '保存' // 更新状态为保存 |
| | | }); |
| | | if (data.preserveSignature) { |
| | | vaccinationSlopesConfirm({ id: this.form.vaccinationSlopes[this.editInoculationIndex].id, preserveSignature: data.preserveSignature }).then(res => { |
| | | if (this.editInoculationIndex !== null) { |
| | | this.$set(this.form.vaccinationSlopes, this.editInoculationIndex, { |
| | | ...this.form.vaccinationSlopes[this.editInoculationIndex], |
| | | preserveSignature: data.preserveSignature, // 更新签名数据 |
| | | status: '保存' // 更新状态为保存 |
| | | }); |
| | | } |
| | | this.showConfirmStorageDialog = false; |
| | | this.editInoculationIndex = null; |
| | | this.editInoculationData = null; |
| | | }) |
| | | } |
| | | this.showConfirmStorageDialog = false; |
| | | this.editInoculationIndex = null; |
| | | this.editInoculationData = null; |
| | | }, |
| | | handleDeleteInoculation(index) { |
| | | this.form.vaccinationSlopes.splice(index, 1); |
| | |
| | | this.showConfirmPreserveDialog = true; |
| | | }, |
| | | handleConfirmPreserveSubmit(data) { |
| | | console.log('确认保藏', data) |
| | | // 更新对应行的数据,保留原有数据并更新签名 |
| | | if (this.editPreserveIndex !== null) { |
| | | this.$set(this.form.culturePreservations, this.editPreserveIndex, { |
| | | ...this.form.culturePreservations[this.editPreserveIndex], |
| | | preserveSignature: data.preserveSignature, // 更新签名数据 |
| | | preserveTime: data.preserveTime, |
| | | }); |
| | | if (data.preserveSignature) { |
| | | culturePreservationsConfirm({ id: this.form.culturePreservations[this.editPreserveIndex].id, preserveSignature: data.preserveSignature }).then(res => { |
| | | if (this.editPreserveIndex !== null) { |
| | | this.$set(this.form.culturePreservations, this.editPreserveIndex, { |
| | | ...this.form.culturePreservations[this.editPreserveIndex], |
| | | preserveSignature: data.preserveSignature, // 更新签名数据 |
| | | preserveTime: data.preserveTime, |
| | | }); |
| | | } |
| | | this.showConfirmPreserveDialog = false; |
| | | this.editPreserveIndex = null; |
| | | this.editPreserveData = null; |
| | | }) |
| | | } |
| | | this.showConfirmPreserveDialog = false; |
| | | this.editPreserveIndex = null; |
| | | this.editPreserveData = null; |
| | | |
| | | }, |
| | | }, |
| | | }; |