|
@@ -655,7 +655,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</up-form-item>
|
|
</up-form-item>
|
|
|
- <up-form-item borderBottom label="培养基配方" prop="cultureMediumFormula" id="cultureMediumFormulapppp">
|
|
|
|
|
|
|
+ <!-- <up-form-item borderBottom label="培养基配方" prop="cultureMediumFormula" id="cultureMediumFormulapppp">
|
|
|
<Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择培养基配方" style="flex: 1" />
|
|
<Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择培养基配方" style="flex: 1" />
|
|
|
<view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
|
|
<view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
|
|
|
<up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
|
|
<up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
|
|
@@ -672,7 +672,7 @@
|
|
|
<text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
|
|
<text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </up-form-item>
|
|
|
|
|
|
|
+ </up-form-item> -->
|
|
|
<ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
|
|
<ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
|
|
|
<up-form-item borderBottom label="选择繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
|
|
<up-form-item borderBottom label="选择繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
|
|
|
<view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
|
|
<view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
|
|
@@ -739,10 +739,18 @@
|
|
|
<view class="d-flex pt-20 pb-20">
|
|
<view class="d-flex pt-20 pb-20">
|
|
|
<view class="">个体标识({{ animalIds.length }}个)</view>
|
|
<view class="">个体标识({{ animalIds.length }}个)</view>
|
|
|
<view class="flex1"></view>
|
|
<view class="flex1"></view>
|
|
|
- <view class="border-#79C58C radius-100 c-primary f-s-24 pd4-10-20-10-20 d-flex a-c j-c" @click="">扫一扫添加</view>
|
|
|
|
|
|
|
+ <view class="border-#79C58C radius-100 c-primary f-s-24 pd4-10-20-10-20 d-flex a-c j-c" @click="handleScanAdd">扫一扫添加</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="d-flex gap-20 mb-20">
|
|
<view class="d-flex gap-20 mb-20">
|
|
|
- <view @click="showDeleteDialog = true" class="b-radius border-#AFDDBB bg-#FBFDFB c-primary w-100% d-flex j-c a-c h-100 f-s-34">手动输入添加</view>
|
|
|
|
|
|
|
+ <view
|
|
|
|
|
+ @click="
|
|
|
|
|
+ editIndex = -1;
|
|
|
|
|
+ animalId = null;
|
|
|
|
|
+ showAnimalIdDialog = true;
|
|
|
|
|
+ "
|
|
|
|
|
+ class="b-radius border-#AFDDBB bg-#FBFDFB c-primary w-100% d-flex j-c a-c h-100 f-s-34"
|
|
|
|
|
+ >手动输入添加</view
|
|
|
|
|
+ >
|
|
|
<view class="b-radius border-#A3E5EA c-#18BECA bg-#FAFFFF w-100% d-flex j-c a-c h-100 f-s-34">从种源库快速添加</view>
|
|
<view class="b-radius border-#A3E5EA c-#18BECA bg-#FAFFFF w-100% d-flex j-c a-c h-100 f-s-34">从种源库快速添加</view>
|
|
|
</view>
|
|
</view>
|
|
|
<up-swipe-action>
|
|
<up-swipe-action>
|
|
@@ -760,15 +768,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
</z-paging>
|
|
</z-paging>
|
|
|
- <ut-confirm-dialog v-model:show="showDeleteDialog" width="75vw" title="添加个体标识" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleDeleteConfirm" @cancel="handleDeleteCancel">
|
|
|
|
|
- <view class="">
|
|
|
|
|
- <view class="c-#333 f-s-28">个体标识号</view>
|
|
|
|
|
- <view class="">
|
|
|
|
|
- <up-input placeholder="请输入个体标识号" v-model="animalId" border="bottom"></up-input>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </ut-confirm-dialog>
|
|
|
|
|
- <ut-confirm-dialog v-model:show="showChangeDialog" width="75vw" title="修改个体标识" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleChangeConfirm" @cancel="handleChangeCancel">
|
|
|
|
|
|
|
+ <ut-confirm-dialog v-model:show="showAnimalIdDialog" width="75vw" :title="editIndex === -1 ? '添加个体标识' : '修改个体标识'" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleAnimalIdConfirm" @cancel="handleAnimalIdCancel">
|
|
|
<view class="">
|
|
<view class="">
|
|
|
<view class="c-#333 f-s-28">个体标识号</view>
|
|
<view class="c-#333 f-s-28">个体标识号</view>
|
|
|
<view class="">
|
|
<view class="">
|
|
@@ -835,26 +835,74 @@ const changeStartTime = () => {
|
|
|
form.value.queryType6.plannedEndDate = form.value.queryType6.plannedStartDate;
|
|
form.value.queryType6.plannedEndDate = form.value.queryType6.plannedStartDate;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
-//单个溯源都数组
|
|
|
|
|
|
|
+// 单个溯源数组
|
|
|
const animalIds = ref<any>([]);
|
|
const animalIds = ref<any>([]);
|
|
|
const animalId = ref();
|
|
const animalId = ref();
|
|
|
-const showDeleteDialog = ref(false);
|
|
|
|
|
-// 修改耽搁溯源弹窗
|
|
|
|
|
-const showChangeDialog = ref(false);
|
|
|
|
|
-let DialogFlag = ref();
|
|
|
|
|
-const handleChangeConfirm = () => {
|
|
|
|
|
- // 直接在animalIds中找到DialogFlag相同的项然后修改这个项
|
|
|
|
|
- const index = animalIds.value.findIndex((item: any) => item == DialogFlag.value);
|
|
|
|
|
- console.log(index, 'itemToUpdate');
|
|
|
|
|
- if (index !== -1) {
|
|
|
|
|
- animalIds.value[index] = animalId.value;
|
|
|
|
|
|
|
+const editIndex = ref(-1); // 编辑索引,-1 表示添加模式
|
|
|
|
|
+const showAnimalIdDialog = ref(false); // 统一的弹框
|
|
|
|
|
+
|
|
|
|
|
+// 统一的确认方法
|
|
|
|
|
+const handleAnimalIdConfirm = () => {
|
|
|
|
|
+ if (!animalId.value) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请输入个体标识号',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 检查是否已存在(修改时排除自身)
|
|
|
|
|
+ const index = animalIds.value.findIndex((item: any) => item == animalId.value);
|
|
|
|
|
+ if (index !== -1 && index !== editIndex.value) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '个体标识不可重复',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (editIndex.value !== -1) {
|
|
|
|
|
+ // 修改模式
|
|
|
|
|
+ animalIds.value[editIndex.value] = animalId.value;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 添加模式
|
|
|
|
|
+ animalIds.value.push(animalId.value);
|
|
|
}
|
|
}
|
|
|
animalId.value = null;
|
|
animalId.value = null;
|
|
|
- DialogFlag.value = null;
|
|
|
|
|
|
|
+ editIndex.value = -1;
|
|
|
|
|
+ showAnimalIdDialog.value = false;
|
|
|
};
|
|
};
|
|
|
-const handleChangeCancel = () => {
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 取消方法
|
|
|
|
|
+const handleAnimalIdCancel = () => {
|
|
|
animalId.value = null;
|
|
animalId.value = null;
|
|
|
- DialogFlag.value = null;
|
|
|
|
|
|
|
+ editIndex.value = -1;
|
|
|
|
|
+ showAnimalIdDialog.value = false;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 扫一扫添加个体标识
|
|
|
|
|
+const handleScanAdd = () => {
|
|
|
|
|
+ uni.scanCode({
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ const scanResult = res.result;
|
|
|
|
|
+ // 检查是否已存在
|
|
|
|
|
+ if (animalIds.value.includes(scanResult)) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '个体标识不可重复',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 将扫描结果赋值给 animalId
|
|
|
|
|
+ animalId.value = scanResult;
|
|
|
|
|
+ editIndex.value = -1; // 添加模式
|
|
|
|
|
+ // 调用统一的确认方法
|
|
|
|
|
+ handleAnimalIdConfirm();
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: (err) => {
|
|
|
|
|
+ console.log('扫码失败', err);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
// 使用 reactive 创建响应式对象
|
|
// 使用 reactive 创建响应式对象
|
|
|
const options1 = reactive([
|
|
const options1 = reactive([
|
|
@@ -1184,6 +1232,7 @@ const save = () => {
|
|
|
icon: 'success',
|
|
icon: 'success',
|
|
|
duration: 2000,
|
|
duration: 2000,
|
|
|
});
|
|
});
|
|
|
|
|
+ uni.$emit('refreshportList');
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
uni.navigateBack();
|
|
uni.navigateBack();
|
|
|
}, 1000);
|
|
}, 1000);
|
|
@@ -1228,29 +1277,6 @@ const saveDraft = () => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
-//确认添加个体
|
|
|
|
|
-const handleDeleteConfirm = () => {
|
|
|
|
|
- if (animalId.value) {
|
|
|
|
|
- if (animalIds.value.includes(animalId.value)) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '个体标识不可重复',
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- });
|
|
|
|
|
- animalId.value = null;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- animalIds.value.push(animalId.value);
|
|
|
|
|
- animalId.value = null;
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '请输入个体标识号',
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-const handleDeleteCancel = () => {
|
|
|
|
|
- animalId.value = null;
|
|
|
|
|
-};
|
|
|
|
|
const clickSwipe = async (name: any, index: number) => {
|
|
const clickSwipe = async (name: any, index: number) => {
|
|
|
if (name?.index == 0) {
|
|
if (name?.index == 0) {
|
|
|
const res = await uni.showModal({
|
|
const res = await uni.showModal({
|
|
@@ -1271,8 +1297,10 @@ const clickSwipe = async (name: any, index: number) => {
|
|
|
icon: 'success',
|
|
icon: 'success',
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- showChangeDialog.value = true;
|
|
|
|
|
- DialogFlag.value = name?.name;
|
|
|
|
|
|
|
+ // 编辑模式:设置编辑索引和 animalId
|
|
|
|
|
+ editIndex.value = animalIds.value.findIndex((item: any) => item == name?.name);
|
|
|
|
|
+ animalId.value = name?.name;
|
|
|
|
|
+ showAnimalIdDialog.value = true;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
// 如果是组培实验室的话,繁育量是一个计算属性
|
|
// 如果是组培实验室的话,繁育量是一个计算属性
|