|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<z-paging class="" ref="paging" bgColor="#f7f7f7" paging-class="paging-btm-shadow" safe-area-inset-bottom scroll-with-animation>
|
|
<z-paging class="" ref="paging" bgColor="#f7f7f7" paging-class="paging-btm-shadow" safe-area-inset-bottom scroll-with-animation>
|
|
|
<template #top>
|
|
<template #top>
|
|
|
- <ut-navbar :title="did ? '编辑农资入库' : '新增农资入库'" :fixed="false" border></ut-navbar>
|
|
|
|
|
|
|
+ <ut-navbar :title="did && mode === 'copy' ? '新增农资入库' : did ? '编辑农资入库' : '新增农资入库'" :fixed="false" border></ut-navbar>
|
|
|
</template>
|
|
</template>
|
|
|
<up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
|
|
<up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
|
|
|
<!-- 农资信息(复制自 info-edit 字段与顺序) -->
|
|
<!-- 农资信息(复制自 info-edit 字段与顺序) -->
|
|
@@ -23,13 +23,39 @@
|
|
|
</template>
|
|
</template>
|
|
|
</up-form-item>
|
|
</up-form-item>
|
|
|
</ut-action-sheet>
|
|
</ut-action-sheet>
|
|
|
-
|
|
|
|
|
- <!-- 入库数量与单位 -->
|
|
|
|
|
<view class="h-1" id="capacitypppp"></view>
|
|
<view class="h-1" id="capacitypppp"></view>
|
|
|
<view class="h-1" id="unitpppp"></view>
|
|
<view class="h-1" id="unitpppp"></view>
|
|
|
- <up-form-item label="入库量" prop="capacity" required class="form-item-bottom-padding-0">
|
|
|
|
|
- <view class="f-s-30 c-333 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
|
|
|
|
|
- </up-form-item>
|
|
|
|
|
|
|
+ <!-- 入库数量与单位 -->
|
|
|
|
|
+ <template v-if="mode === 'copy'">
|
|
|
|
|
+ <up-form-item label="入库量" required class="form-item-bottom-padding-0">
|
|
|
|
|
+ <div class="flex1 d-flex">
|
|
|
|
|
+ <div class="flex1 ov-hd">
|
|
|
|
|
+ <up-form-item prop="capacity" border-bottom class="form-item-top-padding-0">
|
|
|
|
|
+ <up-input v-model="form.capacity" placeholder="请输入入库量" border="none" clearable></up-input>
|
|
|
|
|
+ </up-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="pd-5"></div>
|
|
|
|
|
+ <div class="min-w-200">
|
|
|
|
|
+ <ut-action-sheet v-model="form.unit" :tabs="pt_materail_unit" mode="custom" title="选择单位">
|
|
|
|
|
+ <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
|
|
|
|
|
+ <view class="flex1" style="line-height: 24px">
|
|
|
|
|
+ <view v-if="form.unit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_materail_unit, form.unit) }}</view>
|
|
|
|
|
+ <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <template #right>
|
|
|
|
|
+ <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </up-form-item>
|
|
|
|
|
+ </ut-action-sheet>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </up-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <up-form-item label="入库量" prop="capacity" required class="form-item-bottom-padding-0">
|
|
|
|
|
+ <view class="f-s-30 c-333 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
|
|
|
|
|
+ </up-form-item>
|
|
|
|
|
+ </template>
|
|
|
<view class="h-1" id="specpppp"></view>
|
|
<view class="h-1" id="specpppp"></view>
|
|
|
<view class="h-1" id="specUnitpppp"></view>
|
|
<view class="h-1" id="specUnitpppp"></view>
|
|
|
<template v-if="!['kg', 'L'].includes(form?.unit as string)">
|
|
<template v-if="!['kg', 'L'].includes(form?.unit as string)">
|
|
@@ -69,7 +95,6 @@
|
|
|
</div>
|
|
</div>
|
|
|
</up-form-item>
|
|
</up-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
-
|
|
|
|
|
<view class="h-1" id="sourceTypepppp"></view>
|
|
<view class="h-1" id="sourceTypepppp"></view>
|
|
|
<ut-action-sheet :tabs="pt_source_type" mode="custom" title="农资来源" v-model="form.sourceType">
|
|
<ut-action-sheet :tabs="pt_source_type" mode="custom" title="农资来源" v-model="form.sourceType">
|
|
|
<up-form-item borderBottom label="农资来源" required prop="sourceType">
|
|
<up-form-item borderBottom label="农资来源" required prop="sourceType">
|
|
@@ -147,8 +172,17 @@
|
|
|
</template>
|
|
</template>
|
|
|
</up-form-item>
|
|
</up-form-item>
|
|
|
</ut-datetime-picker>
|
|
</ut-datetime-picker>
|
|
|
- <!-- 入库批号 -->
|
|
|
|
|
- <up-form-item borderBottom label="入库批号" required prop="batchCode">
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 入库批号 -->
|
|
|
|
|
+ <up-form-item v-if="mode === 'copy'" borderBottom label="入库批号" required prop="batchCode">
|
|
|
|
|
+ <up-input v-model="form.batchCode" placeholder="请输入入库批号" border="none" clearable></up-input>
|
|
|
|
|
+ <template #right>
|
|
|
|
|
+ <up-button @click="generateBatchCode" type="primary"
|
|
|
|
|
+ :customStyle="formItemBtnStyle">随机生成</up-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </up-form-item>
|
|
|
|
|
+ <!-- 入库批号 -->
|
|
|
|
|
+ <up-form-item v-else borderBottom label="入库批号" required prop="batchCode">
|
|
|
<view class="f-s-30 c-333 f-w-5 flex1">{{ form.batchCode }}</view>
|
|
<view class="f-s-30 c-333 f-w-5 flex1">{{ form.batchCode }}</view>
|
|
|
</up-form-item>
|
|
</up-form-item>
|
|
|
<!-- 库房类型 -->
|
|
<!-- 库房类型 -->
|
|
@@ -179,6 +213,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { useClientRequest } from '@/utils/request';
|
|
import { useClientRequest } from '@/utils/request';
|
|
|
|
|
+import { formItemBtnStyle } from '@/assets/styles/uview-plus';
|
|
|
import { AgroProductInstoreAddTypeEnum } from '../models/type';
|
|
import { AgroProductInstoreAddTypeEnum } from '../models/type';
|
|
|
import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
|
|
import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
|
|
|
import SelectWarehouseInput from '@/models/select-warehouse-input/select-warehouse-input.vue';
|
|
import SelectWarehouseInput from '@/models/select-warehouse-input/select-warehouse-input.vue';
|
|
@@ -279,7 +314,7 @@ const submitForm = async () => {
|
|
|
});
|
|
});
|
|
|
try {
|
|
try {
|
|
|
// 这里使用单条入库接口,后端若仍要求 batch,可根据需要包装成数组
|
|
// 这里使用单条入库接口,后端若仍要求 batch,可根据需要包装成数组
|
|
|
- const res = await useClientRequest.post('/plt-api/app/material/edit', form.value);
|
|
|
|
|
|
|
+ const res = mode.value === 'copy' ? await useClientRequest.post('/plt-api/app/material/instore', form.value) : await useClientRequest.post('/plt-api/app/material/edit', form.value);
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
if (!res || res.code !== 200) return;
|
|
if (!res || res.code !== 200) return;
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -306,7 +341,7 @@ const generateBatchCode = async () => {
|
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
|
title: '生成中...',
|
|
title: '生成中...',
|
|
|
});
|
|
});
|
|
|
- const res = await useClientRequest.post('/plt-api/app/material/getBatchCode', {
|
|
|
|
|
|
|
+ const res = await useClientRequest.post('/plt-api/app/plantationTask/getBatchCode', {
|
|
|
plType: 'M',
|
|
plType: 'M',
|
|
|
linkType: 'I',
|
|
linkType: 'I',
|
|
|
});
|
|
});
|
|
@@ -321,6 +356,7 @@ const generateBatchCode = async () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const did = ref('');
|
|
const did = ref('');
|
|
|
|
|
+const mode = ref('');
|
|
|
// 获取详情(仓库信息)
|
|
// 获取详情(仓库信息)
|
|
|
const getDetailById = async (id: string) => {
|
|
const getDetailById = async (id: string) => {
|
|
|
if (!id) return;
|
|
if (!id) return;
|
|
@@ -330,12 +366,22 @@ const getDetailById = async (id: string) => {
|
|
|
...form.value,
|
|
...form.value,
|
|
|
...res.data,
|
|
...res.data,
|
|
|
};
|
|
};
|
|
|
|
|
+ if (mode.value === 'copy') {
|
|
|
|
|
+ form.value.batchCode = '';
|
|
|
|
|
+ form.value.id = undefined;
|
|
|
|
|
+ form.value.instoreBizInfo.instoreDate = parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
|
|
+ form.value.warehouses = [];
|
|
|
|
|
+ form.value.capacity = '';
|
|
|
|
|
+ form.value.spec = '';
|
|
|
|
|
+ form.value.specUnit = '';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 页面入参解析并加载
|
|
// 页面入参解析并加载
|
|
|
onLoad((options: any) => {
|
|
onLoad((options: any) => {
|
|
|
did.value = options?.id || '';
|
|
did.value = options?.id || '';
|
|
|
|
|
+ mode.value = options?.mode || '';
|
|
|
getDetailById(did.value);
|
|
getDetailById(did.value);
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
@@ -357,13 +403,13 @@ onLoad((options: any) => {
|
|
|
z-index: 10;
|
|
z-index: 10;
|
|
|
}
|
|
}
|
|
|
:deep(.form-item-top-padding-0) {
|
|
:deep(.form-item-top-padding-0) {
|
|
|
- >.u-form-item__body {
|
|
|
|
|
|
|
+ > .u-form-item__body {
|
|
|
padding-top: 0rpx;
|
|
padding-top: 0rpx;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
:deep(.form-item-bottom-padding-0) {
|
|
:deep(.form-item-bottom-padding-0) {
|
|
|
- >.u-form-item__body {
|
|
|
|
|
|
|
+ > .u-form-item__body {
|
|
|
padding-bottom: 0rpx;
|
|
padding-bottom: 0rpx;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|