2 Commits bca5abdd87 ... a8d99adb5c

Author SHA1 Message Date
  lisy a8d99adb5c Merge branch 'master' of http://git.yujin.shuziyunyao.com/yujin/forestry-wx 2 weeks ago
  lisy 2f629bff2c 加工完成 2 weeks ago

+ 10 - 6
src/pages/plant/port/index.vue

@@ -1,9 +1,9 @@
 <template>
     <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" hide-no-more-inside>
         <template #top>
-            <ut-navbar title="种养殖任务" :fixed="false">
+            <up-navbar title="种养殖任务" :fixed="false">
                 <template #left><view class=""></view></template>
-            </ut-navbar>
+            </up-navbar>
         </template>
         <view class="d-flex a-c pd-24 pb-0 bg-#f7f7f7">
             <view class="min-w-170 flex1">
@@ -28,8 +28,6 @@
                 </up-swipe-action-item>
             </up-swipe-action>
         </view>
-        <view class="h-210" v-if="list?.length"></view>
-        <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
         <template #empty v-if="form?.status == '1'">
             <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
                 <ut-empty class="mg-at" color="#ccc" size="28rpx" image="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/noEmptyBase.png">暂无进行中的养殖任务</ut-empty>
@@ -76,7 +74,6 @@
 </template>
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
-import { onShareAppMessage } from '@dcloudio/uni-app';
 import Task from './models/task.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_task_type } = toRefs<any>(proxy?.useDict('pt_task_type'));
@@ -97,7 +94,6 @@ const subList = ref([
     { label: '进行中', value: '1' },
     { label: '已结束', value: '9' },
 ]);
-const subCurrent = ref(0);
 const changeSeach = () => {
     paging.value.reload();
 };
@@ -202,6 +198,14 @@ const clickTempSwipe = async (event: object) => {
         }
     }
 };
+const refreshList = () => {
+    paging.value?.reload();
+};
+
+onMounted(() => {
+    // 添加监听
+    uni.$on('refreshportList', refreshList);
+});
 </script>
 <style lang="scss" scoped>
 // @import '@/assets/styles/theme.scss';

+ 64 - 15
src/pages/plant/processing/index.vue

@@ -1,26 +1,31 @@
 <template>
     <z-paging ref="paging" bgColor="#F7F7F7">
         <template #top>
-            <ut-navbar title="加工及包装赋码任务" :fixed="false" :breadcrumb="false">
-                <template #left> </template>
+            <ut-navbar title="产地加工及包装赋码任务" :fixed="false" :breadcrumb="false">
+                <template #left><view class=""></view></template>
             </ut-navbar>
         </template>
-        <view class="base-content pd-20">
-            <view class="bg-#fff d-flex a-c j-c radius-16 pd2-30-24 mb-20" @click="$u.route({ url: '/plant/processing/processing-index/index' })">
-                <image class="w-72 h-72" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/storage/nav_kfgl_icon.png" mode="widthFix" />
-                <view class="flex1 pd2-0-20">
-                    <view class="f-s-30 c-#333 f-w-500">加工</view>
-                    <view class="f-s-22 c-#999">对原材料进行加工处理</view>
+        <view class="h-40"></view>
+        <view class="base-content pd-20 b-radius">
+            <!-- 产地加工卡片 -->
+            <view class="process-card" @click="$u.route({ url: '/plant/processing/processing-index/index' })">
+                <view class="w-200 h-200 d-flex a-c j-c" style="flex-shrink: 0">
+                    <image class="w-100% h-100%" src="/static/images/plant/processing/initial_processing.png" mode="aspectFit" />
+                </view>
+                <view class="card-content">
+                    <view class="f-s-46 c-#333 f-w-6 mb-12">产地加工</view>
+                    <view class="card-desc">可对种子、鲜货进行初加工、趁鲜切制加工</view>
                 </view>
-                <up-icon name="arrow-right"></up-icon>
             </view>
-            <view class="bg-#fff d-flex a-c j-c radius-16 pd2-30-24 mb-20" @click="$u.route({ url: '/plant/packaging/list/index' })">
-                <image class="w-72 h-72" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/storage/nav_zyk_icon.png" mode="widthFix" />
-                <view class="flex1 pd2-0-20">
-                    <view class="f-s-30 c-#333 f-w-500">包装赋码</view>
-                    <view class="f-s-22 c-#999">对加工后的产品进行包装</view>
+            <!-- 包装赋码卡片 -->
+            <view class="process-card" @click="$u.route({ url: '/plant/packaging/list/index' })">
+                <view class="w-200 h-200 d-flex a-c j-c" style="flex-shrink: 0">
+                    <image class="w-100% h-100%" src="/static/images/plant/processing/packaging_coding.png" mode="aspectFit" />
+                </view>
+                <view class="card-content">
+                    <view class="f-s-46 c-#333 f-w-6 mb-12">包装赋码</view>
+                    <view class="card-desc">可对种源、鲜货、药材进行包装</view>
                 </view>
-                <up-icon name="arrow-right"></up-icon>
             </view>
         </view>
         <template #bottom>
@@ -28,4 +33,48 @@
         </template>
     </z-paging>
 </template>
+
 <script setup lang="ts"></script>
+
+<style lang="scss" scoped>
+.base-content {
+    padding-top: 10px;
+    background: linear-gradient(to bottom, #dcf8d9, #f7f7f7 70rpx);
+    border: 1rpx solid #fff;
+}
+
+.process-card {
+    display: flex;
+    align-items: center;
+    background-color: #fff;
+    border-radius: 16rpx;
+    margin-bottom: 24rpx;
+    padding: 30rpx 24rpx;
+    border: 2rpx solid #b8e6d5;
+    // box-shadow: inset 0 2rpx 8rpx rgba(184, 230, 213, 0.3);
+    box-shadow:
+        inset 0 5px 10px 9px #edf8f2,
+        inset 0 -5px 10px -5px #edf8f2;
+    filter: drop-shadow(-1px 2px 3px #9ad4b6);
+
+    overflow: hidden;
+}
+
+.card-image-wrapper {
+    flex-shrink: 0;
+}
+
+.card-content {
+    flex: 1;
+    padding-left: 30rpx;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+}
+
+.card-desc {
+    font-size: 24rpx;
+    color: #999;
+    line-height: 1.5;
+}
+</style>

+ 80 - 52
src/plant/port/port-create/index.vue

@@ -655,7 +655,7 @@
                                 </view>
                             </view>
                         </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" />
                             <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>
@@ -672,7 +672,7 @@
                                     <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
                                 </view>
                             </view>
-                        </up-form-item>
+                        </up-form-item> -->
                         <ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
                             <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>
@@ -739,10 +739,18 @@
                     <view class="d-flex pt-20 pb-20">
                         <view class="">个体标识({{ animalIds.length }}个)</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 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>
                     <up-swipe-action>
@@ -760,15 +768,7 @@
             </view>
         </template>
     </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="c-#333 f-s-28">个体标识号</view>
             <view class="">
@@ -835,26 +835,74 @@ const changeStartTime = () => {
         form.value.queryType6.plannedEndDate = form.value.queryType6.plannedStartDate;
     }
 };
-//单个溯源数组
+// 单个溯源数组
 const animalIds = ref<any>([]);
 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;
-    DialogFlag.value = null;
+    editIndex.value = -1;
+    showAnimalIdDialog.value = false;
 };
-const handleChangeCancel = () => {
+
+// 取消方法
+const handleAnimalIdCancel = () => {
     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 创建响应式对象
 const options1 = reactive([
@@ -1184,6 +1232,7 @@ const save = () => {
                     icon: 'success',
                     duration: 2000,
                 });
+                uni.$emit('refreshportList');
                 setTimeout(() => {
                     uni.navigateBack();
                 }, 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) => {
     if (name?.index == 0) {
         const res = await uni.showModal({
@@ -1271,8 +1297,10 @@ const clickSwipe = async (name: any, index: number) => {
             icon: 'success',
         });
     } 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;
     }
 };
 // 如果是组培实验室的话,繁育量是一个计算属性

+ 0 - 1
src/plant/port/port-harvest/models/task_card.vue

@@ -56,7 +56,6 @@
                         <text v-for="(item, index) in data?.baseRef?.baseInfo?.landList" :key="index"><text v-if="index != 0">、</text> {{ item?.landName }}</text>
                     </view>
                 </view>
-                <view class="flex1 d-flex j-ed"><up-icon name="arrow-right" size="34rpx"></up-icon></view>
             </view>
             <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
                 <view class="d-flex a-c w-50%">

+ 0 - 1
src/plant/port/port-listinfo/models/task_card.vue

@@ -56,7 +56,6 @@
                         <text v-for="(item, index) in data?.baseRef?.baseInfo?.landList" :key="index"><text v-if="index != 0">、</text> {{ item?.landName }}</text>
                     </view>
                 </view>
-                <view class="flex1 d-flex j-ed"><up-icon name="arrow-right" size="34rpx"></up-icon></view>
             </view>
             <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
                 <view class="d-flex a-c w-50%">

+ 0 - 1
src/plant/port/port-supervise/models/task_card.vue

@@ -56,7 +56,6 @@
                         <text v-for="(item, index) in data?.baseRef?.baseInfo?.landList" :key="index"><text v-if="index != 0">、</text> {{ item?.landName }}</text>
                     </view>
                 </view>
-                <view class="flex1 d-flex j-ed"><up-icon name="arrow-right" size="34rpx"></up-icon></view>
             </view>
             <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
                 <view class="d-flex a-c w-50%">

+ 2 - 2
src/plant/processing/processing-create/index.vue

@@ -406,8 +406,8 @@ onLoad((options: any) => {
         }
     } else {
         // 创建模式
-        form.value.processType = options?.taskType;
-        if (+options?.taskType == 2) {
+        form.value.processType = options?.processType;
+        if (+options?.processType == 2) {
             pageTitle.value = '创建趁鲜切制任务';
             form.value.processMedType = '2';
         }

+ 1 - 1
src/plant/processing/processing-depstock/index.vue

@@ -185,7 +185,7 @@ const submitForm = async () => {
                 batchCode: form.value.batchCode,
                 warehouses: form.value.warehouses.map((w) => ({
                     warehouseId: w.warehouseId,
-                    shelfId: w.shelfId || 0,
+                    shelfId: w.shelfId,
                 })),
                 instoreType: form.value.instoreType,
                 instorer: form.value.instorer,

+ 2 - 1
src/plant/processing/processing-depstock/models/select-seed-dialog.vue

@@ -14,7 +14,7 @@
                     </template>
                 </view>
                 <!-- 底部按钮 -->
-                <view class="w-700 bg-#fff h-100 d-flex a-c gap-20 pt-24 pb-24 bottom-btns z-index-20" style="position: fixed; bottom: 0; right: 0">
+                <view class="w-700 bg-#fff h-100 d-flex a-c gap-20 pt-24 pb-24 bottom-btns z-index-20">
                     <up-button @click="handleCancel" :customStyle="{ flex: 1, marginRight: '10rpx', marginLeft: '10rpx' }">取消</up-button>
                     <up-button @click="handleConfirm" type="primary" :customStyle="{ flex: 1, marginRight: '10rpx', marginLeft: '10rpx' }">确认选择</up-button>
                 </view>
@@ -58,6 +58,7 @@ const getList = async () => {
             pageNum: 1,
             pageSize: 100,
             processId: props.processId,
+            status: 0,
         });
         if (res && res.code === 200) {
             list.value = res.rows || [];

+ 5 - 1
src/plant/processing/processing-detail-list/index.vue

@@ -63,7 +63,7 @@
             </view>
             <!-- 原料信息列表 -->
             <view v-if="+activeTab == 0">
-                <view v-if="list.length === 0 && +activeTab == 0" class="d-flex flex-cln a-c pd-40">
+                <view v-if="list.length === 0 && +activeTab == 0 && !loading" class="d-flex flex-cln a-c pd-40">
                     <ut-empty color="#ccc" size="28rpx" image=" https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/noEmpty.png">暂无加工原料信息</ut-empty>
                     <up-button type="primary" @click="goAssociate">去关联原料信息</up-button>
                 </view>
@@ -177,6 +177,7 @@ const list = ref<any[]>([]);
 const taskId = ref('');
 const taskDetail = ref<any>({});
 const outputList = ref<any[]>([]);
+const loading = ref(false);
 
 const activeTab = ref(0);
 const tabs = [
@@ -203,6 +204,7 @@ const loadTaskDetail = async () => {
 
 // z-paging 查询原料列表
 const query = async (pageNum: number, pageSize: number) => {
+    loading.value = true;
     try {
         const res = await useClientRequest.get('/plt-api/app/processInputMaterial/pageList', {
             pageNum,
@@ -217,6 +219,8 @@ const query = async (pageNum: number, pageSize: number) => {
     } catch (error) {
         console.error('加载原料列表失败:', error);
         paging.value.complete([]);
+    } finally {
+        loading.value = false;
     }
 };
 const goAssociate = () => {

+ 7 - 8
src/plant/processing/processing-detail-list/models/outputInfo.vue

@@ -1,8 +1,8 @@
 <template>
     <up-popup :show="show" mode="bottom" @close="handleClose" :round="20" closeable>
-        <view class="d-flex flex-cln h-100%" style="max-height: 70vh">
+        <view class="d-flex flex-cln" style="max-height: 70vh">
             <view class="f-s-34 f-w-5 pd-24 pb-16">{{ getTitle() }}</view>
-            <scroll-view scroll-y class="h-0 flex1">
+            <scroll-view scroll-y class="flex1" style="max-height: 70vh">
                 <view class="pd-24">
                     <up-form ref="formRef" :model="formData" :rules="rules" labelPosition="top" labelWidth="auto">
                         <template v-if="+type == 1">
@@ -136,13 +136,12 @@
                         </template>
                     </up-form>
                 </view>
+                <!-- 底部按钮 -->
+                <view class="d-flex gap-20 pd-24">
+                    <up-button plain type="info" @click="handleClose">取消</up-button>
+                    <up-button type="primary" @click="handleSubmit">确认</up-button>
+                </view>
             </scroll-view>
-
-            <!-- 底部按钮 -->
-            <view class="d-flex gap-20 pd-24">
-                <up-button plain type="info" @click="handleClose">取消</up-button>
-                <up-button type="primary" @click="handleSubmit">确认</up-button>
-            </view>
         </view>
     </up-popup>
 </template>

+ 1 - 3
src/plant/processing/processing-index/index.vue

@@ -1,7 +1,7 @@
 <template>
     <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" hide-no-more-inside>
         <template #top>
-            <up-navbar title="加工及包装赋码任务" :fixed="false"> </up-navbar>
+            <ut-navbar title="产地加工" :fixed="false"> </ut-navbar>
         </template>
         <template>
             <view class="d-flex a-c pd-24 pb-0 bg-#f7f7f7">
@@ -78,8 +78,6 @@
                 </up-swipe-action>
             </view>
         </template>
-        <view class="h-210" v-if="list?.length"></view>
-        <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
         <template #empty>
             <view class="d-flex flex-cln a-c">
                 <ut-empty class="mg-at" color="#ccc" size="28rpx" image="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/noEmptyBase.png">暂无加工任务</ut-empty>

+ 7 - 8
src/plant/processing/processing-index/models/outputInfo.vue

@@ -1,8 +1,8 @@
 <template>
     <up-popup :show="show" mode="bottom" @close="handleClose" :round="20" closeable>
-        <view class="d-flex flex-cln h-100%" style="max-height: 70vh">
+        <view class="d-flex flex-cln" style="max-height: 70vh">
             <view class="f-s-34 f-w-5 pd-24 pb-16">{{ getTitle() }}</view>
-            <scroll-view scroll-y class="h-0 flex1">
+            <scroll-view scroll-y class="flex1" style="max-height: 70vh">
                 <view class="pd-24">
                     <up-form ref="formRef" :model="formData" :rules="rules" labelPosition="top" labelWidth="auto">
                         <template v-if="+type == 1">
@@ -136,13 +136,12 @@
                         </template>
                     </up-form>
                 </view>
+                <!-- 底部按钮 -->
+                <view class="d-flex gap-20 pd-24">
+                    <up-button plain type="info" @click="handleClose">取消</up-button>
+                    <up-button type="primary" @click="handleSubmit">确认</up-button>
+                </view>
             </scroll-view>
-
-            <!-- 底部按钮 -->
-            <view class="d-flex gap-20 pd-24">
-                <up-button plain type="info" @click="handleClose">取消</up-button>
-                <up-button type="primary" @click="handleSubmit">确认</up-button>
-            </view>
         </view>
     </up-popup>
 </template>

BIN
src/static/images/plant/processing/initial_processing.png


BIN
src/static/images/plant/processing/packaging_coding.png