handleClickable('paralle', paralleIndex, e)"
:ref="`paralleStepFormPackageRef_${paralleIndex}`" :formConfig="paralleStepFormConfig"
@@ -124,6 +124,7 @@ import CustomTable from '@/components/Template/CustomTable.vue';
import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue';
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue";
import { getExpireDate, duplicateResource } from "@/utils/index.js";
+import { getuuid } from "@/utils/index.js";
import { isCommonUnit } from "@/utils/conTools";
import moment from "moment";
import { addTj, uniqeResource, uniqeResourceOne, addDecimals } from "@/utils/calUnitTools";
@@ -397,6 +398,7 @@ export default {
}
// 添加新的平行配制配置
this.formData.paralleConfigs.push({
+ id: getuuid(),
paralleStepData: [],
paralleTableFormData: [],
showParalleConfig: true
@@ -411,21 +413,30 @@ export default {
// 添加新的阶梯配制配置
this.formData.ladderConfigs.push({
+ id: getuuid(),
ladderStepData: [],
ladderTableFormData: [],
showLadderConfig: true
});
},
// 删除阶梯配制配置
- deleteLadderConfig(index) {
- this.formData.ladderConfigs.splice(index, 1);
- this.$set(this.formData, 'ladderConfigs', this.formData.ladderConfigs);
- },
- // 删除平行配制配置
- deleteParalleConfig(index) {
- debugger
- this.formData.paralleConfigs.splice(index, 1);
- this.$set(this.formData, 'paralleConfigs', this.formData.paralleConfigs);
+ deleteConfig(type, config) {
+ const configIndex = this.formData[type].findIndex(config => config.id === config.id);
+ if (configIndex !== -1) {
+ // 创建新数组,确保响应式更新
+ const newConfigs = [...this.formData[type]];
+ newConfigs.splice(configIndex, 1);
+ this.$set(this.formData, type, newConfigs);
+ this.$nextTick(() => {
+ //通知后端保存数据
+ const params = {
+ type: "fieldChanged",
+ newRecord: null,
+ resourceList: null,
+ }
+ EventBus.$emit('onModifyRecord', params,)
+ })
+ }
},
// 添加表格行
handleAddRow(type, rowIndex, configIndex = 0) {
@@ -631,6 +642,7 @@ export default {
const ladderConfigsData = [];
if (this.formData.ladderConfigs && this.formData.ladderConfigs.length > 0) {
for (let i = 0; i < this.formData.ladderConfigs.length; i++) {
+ const id = this.formData.ladderConfigs[i].id;
const ladderFormData = this.$refs[`ladderStepFormPackageRef_${i}`][0].getFilledFormData();
const ladderTableFormData = this.$refs[`ladderStepTableRef_${i}`][0].getFilledFormData();
const ladderStepData = this.$refs[`ladderStepRef_${i}`][0].getFilledFormData();
@@ -639,7 +651,8 @@ export default {
...ladderFormData,
...ladderTableFormData,
ladderStepData: ladderStepData.stepData,
- showLadderConfig: true
+ showLadderConfig: true,
+ id
});
}
}
@@ -648,6 +661,7 @@ export default {
const paralleConfigsData = [];
if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) {
for (let i = 0; i < this.formData.paralleConfigs.length; i++) {
+ const id = this.formData.paralleConfigs[i].id;
const paralleFormData = this.$refs[`paralleStepFormPackageRef_${i}`][0].getFilledFormData();
const paralleTableFormData = this.$refs[`paralleStepTableRef_${i}`][0].getFilledFormData();
const paralleStepData = this.$refs[`paralleStepRef_${i}`][0].getFilledFormData();
@@ -656,7 +670,8 @@ export default {
...paralleFormData,
...paralleTableFormData,
paralleStepData: paralleStepData.stepData,
- showParalleConfig: true
+ showParalleConfig: true,
+ id
});
}
}