lisy il y a 1 mois
Parent
commit
bb8bd9bc4c

+ 13 - 19
src/pages/plant/port/index.vue

@@ -18,25 +18,25 @@
                 <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" @change="changeSeach" margin="0" :border="false" placeholder="搜批次号、品种名、基地名" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
             </view>
         </view>
-        <view class="pd-24 bg-#f7f7f7" :style="{ width: windowInfo ? windowInfo.screenWidth - 26 + 'px' : '100%' }">
-            <up-subsection :list="subList" :current="subCurrent" @change="sectionChange" style="width: 100%; height: 100rpx; background-color: #fff" inactive-color="#999" active-color="#37A954" fontSize="36rpx" mode="subsection"></up-subsection>
+        <view class="pd-24 bg-#f7f7f7">
+            <ut-tabs mode="subsection" v-model="form.status" @change="changeSeach" :tabs="subList"></ut-tabs>
         </view>
-        <view class="pd-24">
+        <view class="pd-24 pt-0">
             <up-swipe-action>
-                <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="subCurrent === 0 ? options2 : options" class="mb-20" @click="clickTempSwipe">
+                <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="form?.status == '1' ? options2 : options" class="mb-20" @click="clickTempSwipe">
                     <task :data="item" :status="form?.status" @click="$u.route({ type: 'navigateTo', url: '/plant/port/port-detail/index', params: { id: item?.id } })" @toSupervise="$u.route({ type: 'navigateTo', url: '/plant/port/port-supervise/index', params: { id: item?.id } })" @toInformation="$u.route({ type: 'navigateTo', url: '/plant/port/port-listinfo/index', params: { id: item?.id } })" />
                 </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="subCurrent == 0">
+        <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>
                 <text class="c-#ccc f-s-28">点击下方按钮去添加吧~</text>
             </view>
         </template>
-        <template #empty v-if="subCurrent == 1">
+        <template #empty v-if="form?.status == '9'">
             <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>
             </view>
@@ -81,7 +81,7 @@ import Task from './models/task.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_task_type } = toRefs<any>(proxy?.useDict('pt_task_type'));
 const list = ref<unknown[]>();
-const form = ref({ taskType: '', keyword: '', status: 1 });
+const form = ref({ taskType: '', keyword: '', status: '1' });
 const paging = ref();
 const windowInfo = uni.getWindowInfo();
 const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
@@ -93,17 +93,11 @@ const sus = ref({
 sus.value.left = systemInfo.windowWidth - 10;
 sus.value.bottom = systemInfo.windowHeight - 200;
 //分段器的配置
-const subList = ref(['进行中', '已结束']);
+const subList = ref([
+    { label: '进行中', value: '1' },
+    { label: '已结束', value: '9' },
+]);
 const subCurrent = ref(0);
-const sectionChange = (index: number) => {
-    subCurrent.value = index;
-    if (index == 0) {
-        form.value.status = 1;
-    } else {
-        form.value.status = 9;
-    }
-    paging.value.reload();
-};
 const changeSeach = () => {
     paging.value.reload();
 };
@@ -165,7 +159,7 @@ const handlechoseConfirm = () => {
 };
 const clickTempSwipe = async (event: object) => {
     const { name, index } = event as any;
-    if (subCurrent.value == 1) {
+    if (form.value?.status == '9') {
         const res = await uni.showModal({
             title: '恢复提示',
             content: '确定恢复该任务吗?',
@@ -184,7 +178,7 @@ const clickTempSwipe = async (event: object) => {
         });
         paging.value?.reload();
     }
-    if (index === 1 && subCurrent.value == 0) {
+    if (index === 1 && form.value?.status == '1') {
         try {
             const res = await uni.showModal({
                 title: '结束提示',

+ 13 - 48
src/plant/port/port-create/index.vue

@@ -13,10 +13,7 @@
                     </view>
                     <view class="bg-#fff pd-24 mb-20 pt-0">
                         <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
-                            <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="openDrawer">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择种养殖所在的基地</view>
-                            </view>
+                            <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
                             <view class="w-100%" v-else>
                                 <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
                             </view>
@@ -48,10 +45,7 @@
                             </up-form-item>
                         </ut-action-sheet>
                         <up-form-item borderBottom label="动物名称" required prop="varietyId" id="varietyIdpppp">
-                            <view v-if="!Biological" @click="gotoTorganism(1)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择养植的动物名称</view>
-                            </view>
+                            <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>
                                 <view class="mb-20">
@@ -140,10 +134,7 @@
                     </view>
                     <view class="bg-#fff pd-24 mb-20 pt-0">
                         <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
-                            <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="openDrawer">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择种养殖所在的基地</view>
-                            </view>
+                            <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
                             <view class="w-100%" v-else>
                                 <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
                             </view>
@@ -191,10 +182,7 @@
                             </up-form-item>
                         </ut-action-sheet>
                         <up-form-item borderBottom label="动物名称" required prop="varietyId" id="varietyIdpppp">
-                            <view v-if="!Biological" @click="gotoTorganism(1)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择养植的动物名称</view>
-                            </view>
+                            <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>
                                 <view class="mb-20">
@@ -283,10 +271,7 @@
                     </view>
                     <view class="bg-#fff pd-24 mb-20 pt-0">
                         <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
-                            <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="openDrawer">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择种养殖所在的基地</view>
-                            </view>
+                            <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
                             <view class="w-100%" v-else>
                                 <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
                             </view>
@@ -309,10 +294,7 @@
                             </up-form-item>
                         </ut-action-sheet>
                         <up-form-item borderBottom label="植物名称" required prop="varietyId" id="varietyIdpppp">
-                            <view v-if="!Biological" @click="gotoTorganism(1)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择种植的植物名称</view>
-                            </view>
+                            <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>
                                 <view class="mb-20">
@@ -417,10 +399,7 @@
                             </up-form-item>
                         </ut-action-sheet>
                         <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
-                            <view v-if="!PreBiological" @click="gotoTorganism(2)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择前茬植物名称</view>
-                            </view>
+                            <Go_button v-if="!PreBiological" @click="gotoTorganism(2)" title="请选择前茬植物名称" style="flex: 1" />
                             <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
                                 <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
                                 <view class="mb-20">
@@ -452,19 +431,13 @@
                     </view>
                     <view class="bg-#fff pd-24 mb-20 pt-0">
                         <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
-                            <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="openDrawer">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择种养殖所在的基地</view>
-                            </view>
+                            <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
                             <view class="w-100%" v-else>
                                 <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
                             </view>
                         </up-form-item>
                         <up-form-item :borderBottom="false" label="具体位置" required prop="baseId" id="baseIdpppp">
-                            <view v-if="!laboratory" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="openLaboratory">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择具体位置</view>
-                            </view>
+                            <Go_button v-if="!laboratory" @click="openLaboratory" title="请选择具体位置" style="flex: 1" />
                             <view class="w-100%" v-else>
                                 <laboratory :modeValue="laboratory" @close="handleLaboratoryClose" :baseType="form.taskType" />
                             </view>
@@ -512,10 +485,7 @@
                             </up-form-item>
                         </ut-action-sheet>
                         <up-form-item borderBottom label="植物名称" required prop="varietyId" id="varietyIdpppp">
-                            <view v-if="!Biological" @click="gotoTorganism(1)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择种植的植物名称</view>
-                            </view>
+                            <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>
                                 <view class="mb-20">
@@ -616,10 +586,7 @@
                             </ut-action-sheet>
                         </up-form-item>
                         <up-form-item borderBottom label="培养基配方" prop="cultureMediumFormula" id="cultureMediumFormulapppp">
-                            <view v-if="!Biological" @click="gotoTorganism(1)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择培养基配方</view>
-                            </view>
+                            <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>
                                 <view class="mb-20">
@@ -673,10 +640,7 @@
                             </up-form-item>
                         </ut-action-sheet>
                         <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
-                            <view v-if="!PreBiological" @click="gotoTorganism(2)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
-                                <view class=""></view>
-                                <view class="f-s-34 c-primary">请选择前茬植物名称</view>
-                            </view>
+                            <Go_button v-if="!PreBiological" @click="gotoTorganism(2)" title="请选择前茬植物名称" style="flex: 1" />
                             <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
                                 <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
                                 <view class="mb-20">
@@ -755,6 +719,7 @@ import { useClientRequest } from '@/utils/request';
 import type { TaskType, YesNoType, TimeRange, PlantInfo, DelegateInfo, InoculationInfo, LandInfo, BaseSelectData, PlantationTaskForm, FormRuleItem, FormRules } from './models/types';
 import Drawer_laboratory from './models/drawer_laboratory.vue';
 import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
+import Go_button from './models/go_button.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_feed_amount_unit, pt_planting_mg_unit, pt_inoculation_unit, pt_inoculation_dosage_unit, pt_transplant_method, pt_plantation_type, pt_sowing_method, pt_area_unit, pt_plantation_method, pt_reproduction_type, pt_scale_unit, pt_feeding_method, pt_mg_method, pt_task_gap_flag, pt_task_type, pt_org_type, yes_no } = toRefs<any>(
     proxy?.useDict('pt_feed_amount_unit', 'pt_planting_mg_unit', 'pt_inoculation_unit', 'pt_inoculation_dosage_unit', 'pt_transplant_method', 'pt_plantation_type', 'pt_sowing_method', 'pt_area_unit', 'pt_plantation_method', 'pt_reproduction_type', 'pt_scale_unit', 'pt_feeding_method', 'pt_mg_method', 'pt_task_gap_flag', 'pt_task_type', 'pt_org_type', 'yes_no'),

+ 18 - 0
src/plant/port/port-create/models/go_button.vue

@@ -0,0 +1,18 @@
+<template>
+    <up-button type="primary" @click="click" plain>
+        <image class="w-36 h-36 mr-10" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/common/select_push_icon.png" mode="widthFix" />
+        <span>{{ title }}</span>
+    </up-button>
+</template>
+<script setup lang="ts">
+const props = defineProps({
+    title: {
+        type: String,
+        default: '',
+    },
+});
+const emit = defineEmits(['click']);
+const click = () => {
+    emit('click');
+};
+</script>