瀏覽代碼

修改字段名称

huangxw 1 周之前
父節點
當前提交
9d905154cf

+ 2 - 2
.env.development

@@ -1,7 +1,7 @@
 # 页面标题
-VITE_TITLE = 林草平台
+VITE_TITLE = 中药材种植全链条追溯系统
 
 # 开发环境配置
 VITE_APP_ENV = 'development'
 # api请求地址
-VITE_API_BASE_URL = 'https://dm.yujin.shuziyunyao.com/api:8888'
+VITE_API_BASE_URL = 'https://dm.yujin.shuziyunyao.com/api'

+ 1 - 1
src/audit/plant/base/audit-detail/models/swyq-detail.vue

@@ -15,7 +15,7 @@
                     </view>
                     <view class="f-s-30 pd2-16-0 info-border-bottom">
                         <span class="c-#666">获评品种:</span>
-                        <span class="c-#333">{{ form?.swyqVarietyName || '-' }}</span>
+                        <span class="c-#333">{{ form?.swyqMedicineName || '-' }}</span>
                     </view>
                     <view class="f-s-30 pd2-16-0 info-border-bottom">
                         <span class="c-#666">获评日期:</span>

+ 1 - 1
src/audit/plant/base/audit-list/models/swyq-base.vue

@@ -27,7 +27,7 @@
                         <view class="d-flex pb-5">
                             <view class="w-50%">
                                 <text class="c-#666 f-s-28">获评品种:</text>
-                                <text class="c-#333 f-s-28 f-w-5">{{ item?.swyqVarietyName || '-' }}</text>
+                                <text class="c-#333 f-s-28 f-w-5">{{ item?.swyqMedicineName || '-' }}</text>
                             </view>
                             <view class="w-50%">
                                 <text class="c-#666 f-s-28">基地面积:</text>

+ 4 - 4
src/pages/plant/base/index.vue

@@ -121,9 +121,9 @@
                                                 <view style="position: absolute; top: 20rpx; left: 0">
                                                     <view class="base-status-gap-1" v-if="+item?.gapFlag">获评{{ item?.gapInfo?.medicineName }}GAP基地</view>
                                                     <template v-if="item?.swyqRes">
-                                                        <view class="base-status-gap-1" v-if="item?.swyqRes == '1'">获评{{ item?.swyqVarietyName }}三无一全基地</view>
-                                                        <view class="base-status-gap-2" v-if="item?.swyqRes == '2'">标记{{ item?.swyqVarietyName }}三无一全基地未通过审核</view>
-                                                        <view class="base-status-gap-0" v-if="item?.swyqRes == '0'">标记{{ item?.swyqVarietyName }}三无一全基地待审核</view>
+                                                        <view class="base-status-gap-1" v-if="item?.swyqRes == '1'">获评{{ item?.swyqMedicineName }}三无一全基地</view>
+                                                        <view class="base-status-gap-2" v-if="item?.swyqRes == '2'">标记{{ item?.swyqMedicineName }}三无一全基地未通过审核</view>
+                                                        <view class="base-status-gap-0" v-if="item?.swyqRes == '0'">标记{{ item?.swyqMedicineName }}三无一全基地待审核</view>
                                                     </template>
                                                 </view>
                                             </view>
@@ -270,7 +270,7 @@ interface BaseData {
     coordinates: Coordinate[][]; // 二维坐标数组
     tempFlag?: number | string;
     swyqRes?: string;
-    swyqVarietyName?: string;
+    swyqMedicineName?: string;
 }
 const instance = getCurrentInstance();
 const list = ref<BaseData[]>();

+ 5 - 5
src/plant/base/gap-base-info-edit/index.vue

@@ -27,9 +27,9 @@
                         <up-input v-model="form.gapBaseName" placeholder="请输入基地名称" border="none" clearable></up-input>
                     </up-form-item>
                     <!-- 选择获评品种 -->
-                    <view class="h-1" id="medicineIdpppp"></view>
-                    <up-form-item @click="selectMedicine" borderBottom label="获评品种" required prop="medicineId">
-                        <view v-if="form.medicineId" class="f-s-30 c-333 f-w-5 flex1">{{ form.medicineName }}</view>
+                    <view class="h-1" id="medicineCodepppp"></view>
+                    <up-form-item @click="selectMedicine" borderBottom label="获评品种" required prop="medicineCode">
+                        <view v-if="form.medicineCode" class="f-s-30 c-333 f-w-5 flex1">{{ form.medicineName }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择获评品种</view>
                         <template #right>
                             <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
@@ -250,8 +250,8 @@ const mapDrawArea = async () => {
 // 改成去选择获评品种页面
 const selectMedicine = () => {
     uni.$on('medicineSelected', (medicine: any) => {
-        form.value.medicineId = medicine.id;
-        form.value.medicineName = medicine.varietyName;
+        form.value.medicineCode = medicine.medicineCode;
+        form.value.medicineName = medicine.medicineName;
         uni.$off('medicineSelected');
     });
     uni.$u.route({

+ 1 - 1
src/plant/base/mark-swyq-base-detail/index.vue

@@ -12,7 +12,7 @@
                     <image class="base_res_logo w-160 h-160" :src="`/static/images/common/base_res_logo${form?.baseInfo?.swyqRes}.png`" mode="widthFix" />
                     <view class="f-s-30 pd2-16-0 info-border-bottom">
                         <span class="c-#666">获评品种:</span>
-                        <span class="c-#333">{{ form?.baseInfo?.swyqVarietyName || '-' }}</span>
+                        <span class="c-#333">{{ form?.baseInfo?.swyqMedicineName || '-' }}</span>
                     </view>
                     <view class="f-s-30 pd2-16-0 info-border-bottom">
                         <span class="c-#666">获评时间:</span>

+ 8 - 8
src/plant/base/mark-swyq-base/index.vue

@@ -14,9 +14,9 @@
                         <!-- 基地信息部分 -->
                         <view>
                             <!-- 选择获评品种 -->
-                            <view class="h-1" id="swyqVarietyIdpppp"></view>
-                            <up-form-item @click="selectMedicine" borderBottom label="获评品种" required prop="swyqVarietyId">
-                                <view v-if="formSwyq.swyqVarietyId" class="f-s-30 c-333 f-w-5 flex1">{{ formSwyq.swyqVarietyName }}</view>
+                            <view class="h-1" id="swyqMedicineCodepppp"></view>
+                            <up-form-item @click="selectMedicine" borderBottom label="获评品种" required prop="swyqMedicineCode">
+                                <view v-if="formSwyq.swyqMedicineCode" class="f-s-30 c-333 f-w-5 flex1">{{ formSwyq.swyqMedicineName }}</view>
                                 <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择获评品种</view>
                                 <template #right>
                                     <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
@@ -116,7 +116,7 @@ const mapUnitByBaseType: any = {
 const form = ref<any>({});
 const formSwyq = ref<any>({
     swyqVarietyId: undefined,
-    swyqVarietyName: '',
+    swyqMedicineName: '',
     swyqRatedDate: '',
     swyqCertFile: '',
     swyqUrl: '',
@@ -132,8 +132,8 @@ const selectMedicine = () => {
     uni.$on('medicineSelected', (medicine: any) => {
         console.log(medicine);
         
-        formSwyq.value.swyqVarietyId = medicine.id;
-        formSwyq.value.swyqVarietyName = medicine.varietyName;
+        formSwyq.value.swyqMedicineCode = medicine.medicineCode;
+        formSwyq.value.swyqMedicineName = medicine.medicineName;
         uni.$off('medicineSelected');
     });
     uni.$u.route({
@@ -150,8 +150,8 @@ const getDetailById = async (id: string) => {
     const res = await useClientRequest.get(`/plt-api/app/base/getInfoAllById/${id}`);
     if (res && res.code === 200) {
         form.value = res.data || {};
-        formSwyq.value.swyqVarietyId = res.data?.baseInfo?.swyqVarietyId || undefined;
-        formSwyq.value.swyqVarietyName = res.data?.baseInfo?.swyqVarietyName || '';
+        formSwyq.value.swyqMedicineCode = res.data?.baseInfo?.swyqMedicineCode || undefined;
+        formSwyq.value.swyqMedicineName = res.data?.baseInfo?.swyqMedicineName || '';
         formSwyq.value.swyqRatedDate = res.data?.baseInfo?.swyqRatedDate || '';
         formSwyq.value.swyqCertFile = res.data?.baseInfo?.swyqCertFile || '';
         formSwyq.value.swyqUrl = res.data?.baseInfo?.swyqUrl || '';

+ 3 - 3
src/plant/port/port-create/models/baseinfo.vue

@@ -5,8 +5,8 @@
         <!-- 标签显示:GAP和三无一全 -->
         <view v-if="+modeValue?.gapFlag || +modeValue?.swyqRes" class="pt-8 pb-8 d-flex pr-20 pl-20" style="width: max-content; margin-top: -10rpx; margin-left: -26rpx; background: linear-gradient(90deg, #5eba75, #c6e391); border-bottom-right-radius: 88rpx">
             <view v-if="+modeValue?.gapFlag && !+modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地</view>
-            <view v-if="+modeValue?.swyqRes && !+modeValue?.gapFlag" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.swyqVarietyName }}三无一全基地</view>
-            <view v-if="+modeValue?.gapFlag && +modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地和{{ modeValue?.swyqVarietyName }}三无一全基地</view>
+            <view v-if="+modeValue?.swyqRes && !+modeValue?.gapFlag" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.swyqMedicineName }}三无一全基地</view>
+            <view v-if="+modeValue?.gapFlag && +modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地和{{ modeValue?.swyqMedicineName }}三无一全基地</view>
         </view>
         <view class="c-#333 f-s-34 f-w-5 pt-8 pb-8 pr-16">{{ modeValue?.baseName }}</view>
         <view class="pt-8 pb-8">
@@ -46,7 +46,7 @@ interface ModeValue {
     // 保留原有字段以保持向后兼容
     checkBox?: any[];
     medicineName: string | null;
-    swyqVarietyName: string | null;
+    swyqMedicineName: string | null;
 }
 
 // 接收modeValue对象

+ 10 - 10
src/plant/port/port-create/models/drawer.vue

@@ -36,12 +36,12 @@
                     <view v-if="mixData.length == 0 && showtitle" class="">请先在左侧添加选择基地,选择后此处将会展示地块/圈舍/组培架信息。</view>
                 </scroll-view>
             </view>
-            <view v-if="medicineName || swyqVarietyName" class="w-700 c-primary bg-#EBF6EE f-s-24" style="position: fixed; bottom: 140rpx; right: 0">
+            <view v-if="medicineName || swyqMedicineName" class="w-700 c-primary bg-#EBF6EE f-s-24" style="position: fixed; bottom: 140rpx; right: 0">
                 <view class="pd4-10-20-10-20 d-flex a-c">
                     <view class="">该基地获评:</view>
                     <view class="" v-if="medicineName">{{ medicineName }}GAP基地</view>
-                    <view class="" v-if="medicineName && swyqVarietyName">和</view>
-                    <view class="" v-if="swyqVarietyName">{{ swyqVarietyName }}三无一全基地 </view>
+                    <view class="" v-if="medicineName && swyqMedicineName">和</view>
+                    <view class="" v-if="swyqMedicineName">{{ swyqMedicineName }}三无一全基地 </view>
                 </view>
             </view>
             <view class="w-700 bg-#fff h-100 d-flex a-c gap-20 pt-20 pb-20" style="position: fixed; bottom: 0; right: 0">
@@ -68,7 +68,7 @@ const list = ref<any[]>([]);
 //左侧GAP基地的名称(种植的作物)
 const medicineName = ref<string>('');
 //左侧三无一全基地的名称
-const swyqVarietyName = ref<string>('');
+const swyqMedicineName = ref<string>('');
 // 右侧地块数据
 const mixData = ref<any[]>([]);
 const showtitle = ref(true);
@@ -81,7 +81,7 @@ const emit = defineEmits<{
     (e: 'update:modelValue', value: boolean): void;
     (e: 'open'): void;
     (e: 'close'): void;
-    (e: 'confirm', data: { medicineName: string; swyqVarietyName: string; checkBox: any[]; data: any[]; aloneChecked: boolean; baseName: string; area?: string; gapFlag: number; swyqRes: number; areaUnit: string; adcodeName: string; address: string }): void; // 新增
+    (e: 'confirm', data: { medicineName: string; swyqMedicineName: string; checkBox: any[]; data: any[]; aloneChecked: boolean; baseName: string; area?: string; gapFlag: number; swyqRes: number; areaUnit: string; adcodeName: string; address: string }): void; // 新增
 }>();
 // 处理关闭事件
 function handleClose() {
@@ -113,7 +113,7 @@ const changeSelect = (index: number) => {
     list.value = [];
     mixData.value = [];
     medicineName.value = '';
-    swyqVarietyName.value = '';
+    swyqMedicineName.value = '';
     allCheckboxNames.value = [];
     checkBox.value = [];
     aloneChecked.value = false;
@@ -133,15 +133,15 @@ const changeBase = (index: number, item: any) => {
     mixData.value = [];
     baseID.value = item.id;
     medicineName.value = '';
-    swyqVarietyName.value = '';
+    swyqMedicineName.value = '';
     allCheckboxNames.value = [];
     checkBox.value = [];
     aloneChecked.value = false;
     if (item.gapInfo?.medicineName) {
         medicineName.value = item.gapInfo.medicineName;
     }
-    if (item.gapInfo?.swyqVarietyName) {
-        swyqVarietyName.value = item.swyqVarietyName;
+    if (item.gapInfo?.swyqMedicineName) {
+        swyqMedicineName.value = item.swyqMedicineName;
     }
 };
 // 选择checkbox>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -224,7 +224,7 @@ const confirm = () => {
             aloneChecked: aloneChecked.value,
             gapFlag: selectedBase.gapFlag,
             swyqRes: selectedBase.swyqRes,
-            swyqVarietyName: selectedBase.swyqVarietyName,
+            swyqMedicineName: selectedBase.swyqMedicineName,
             medicineName: selectedBase.gapInfo?.medicineName,
             data: data,
             checkBox: checkBox.value,

+ 84 - 36
src/tools/select-medicine/index.vue

@@ -1,60 +1,108 @@
 <template>
-    <z-paging ref="paging" safe-area-inset-bottom v-model="list" @query="query">
+    <z-paging ref="paging" v-model="list" bgColor="#fff" @query="query" paging-class="paging-btm-shadow" :auto="false" safe-area-inset-bottom>
         <template #top>
-            <ut-navbar title="选择获评品种" :fixed="false" border></ut-navbar>
-            <view class="pd-20">
-                <ut-search margin="0" height="68rpx" fontSize="26rpx" placeholder="请输入获评品种名称" border v-model="form.keyword" @search="onRefresh"></ut-search>
+            <view class="">
+                <up-navbar title="选择获评品种" @leftClick="navigateBackOrHome()" :fixed="false"></up-navbar>
+                <view class="pd-24">
+                    <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" @change="changeSeach" margin="0" :border="false" placeholder="可输入药材名称或动植物基原名称搜索" bgColor="#f7f7f7" height="86rpx" borderRadius="16rpx"></ut-search>
+                </view>
             </view>
         </template>
-        <view class="base-content pd-20">
-            <view :class="{ active: item.id === checkedId }" v-for="(item, index) in list" :key="item.id" @click="clickItem(item)" class="bg-fff mb-10 pd-20 select-item-card">
-                <view class="f-s-30 c-#333 f-w-600">{{ item?.varietyName }}</view>
-                <view class="f-s-28 c-#999">{{ item.latinName }}</view>
+        <view class="pd-24" v-if="!showSearch">
+            <template v-if="speArray.length">
+                <view class="f-s-32 c-#333 f-w-5 mb-20">快捷选择主营品种</view>
+                <view class="d-flex a-c f-w-w">
+                    <spe-lable class="mr-20 mb-20" v-for="(item, index) in speArray" :key="index" :text="item?.medicineName" size="30rpx" :id="item?.id" @click="changeSpe(item?.medicineName)" />
+                </view>
+            </template>
+            <template>
+                <ut-empty text=""></ut-empty>
+                <view class="d-flex flex-cln j-c a-c">
+                    <view class="c-#ccc f-s-28">您可以<text class="c-primary">直接搜索,</text>或前往<text class="c-primary">基地-主营品种配置</text>页面进行</view>
+                    <view class="c-#ccc f-s-28">主营品种配置,配置后下次即可快捷选择。</view>
+                </view>
+            </template>
+        </view>
+        <view class="pd-24" v-if="showSearch">
+            <view class="f-s-32 c-#333 f-w-5 mb-20">搜索结果</view>
+            <view class="pd-24 d-flex bg-#FBFDFB border-#37A954 b-radius mb-20" v-for="(item, index) in list" :key="index">
+                <up-radio-group v-model="radiovalue1">
+                    <view @click="radiovalue1 = item?.medicineCode" class="d-flex w-100%">
+                        <view class="flex1 ov-hd">
+                            <view class="c-#333 f-s-34 f-w-5 mr-5">{{ item?.medicineName }}</view>
+                            <view class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.medicineCode }}</view>
+                        </view>
+                        <view class="d-flex j-c a-c">
+                            <view @click.stop class="">
+                                <up-radio activeColor="#37A954" label="" :name="item?.medicineCode"> </up-radio>
+                            </view>
+                        </view>
+                    </view>
+                </up-radio-group>
             </view>
         </view>
+        <template #bottom v-if="showSearch">
+            <view class="pd-24 d-flex j-c gap-20">
+                <up-button type="primary" @click="save()">确认选择</up-button>
+            </view>
+        </template>
     </z-paging>
 </template>
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
-const paging = ref<any>(null);
+import SpeLable from '../por-torganism/models/speLable.vue';
+
+const paging = ref();
 const list = ref<any[]>([]);
 const form = ref({
     keyword: '',
 });
-const query = async (pageNum: number, pageSize: number) => {
-    const res = await useClientRequest.get('/plt-api/app/cpyVariety/pageList', {
+const speArray = ref<any[]>([]);
+const showSearch = ref(false);
+const query = async (pageNo: number, pageSize: number) => {
+    const params = {
+        pageNo,
+        pageSize,
         ...form.value,
-        pageNum: pageNum,
-        pageSize: pageSize,
-    });
-    if (res.code == 200) {
-        paging.value.complete(res.rows || []);
+    };
+    const res = await useClientRequest.get('/plt-api/app/medicine/pageList', params);
+    const { rows } = res;
+    paging.value.complete(rows);
+};
+const changeSeach = () => {
+    if (!form.value?.keyword) {
+        showSearch.value = false;
+    } else {
+        showSearch.value = true;
     }
+    paging.value.reload();
 };
-const checkedId = ref(null);
-const clickItem = (item: any) => {
-    checkedId.value = item.id;
-    uni.$emit('medicineSelected', item);
-    uni.navigateBack();
+const changeSpe = (data: string) => {
+    form.value.keyword = data;
+    changeSeach();
 };
-const onRefresh = () => {
-    try {
-        paging.value?.reload();
-    } catch (e) {
-        console.error('Error refreshing address list:', e);
+const getSpecies = async () => {
+    console.log('getSpecies');
+    if (form.value?.keyword) {
+        return;
     }
+    const res = await useClientRequest.get('/plt-api/app/cpyVariety/list');
+    if (res.code === 200) {
+        speArray.value = res.data;
+    }
+};
+const radiovalue1 = ref('苹果');
+const save = () => {
+    const res = list.value.find((item) => item.medicineCode === radiovalue1.value);
+    if (!res) return;
+    uni.$emit('medicineSelected', res);
+    uni.navigateBack({ delta: 1 });
 };
+onMounted(() => {
+    getSpecies();
+});
 onUnload(() => {
+    console.log('????');
     uni.$off('medicineSelected');
 });
 </script>
-<style lang="scss" scoped>
-.select-item-card {
-    box-shadow: 0rpx 2rpx 8rpx rgba(0, 0, 0, 0.1);
-    border: 1rpx solid #e8e8e8;
-
-    &.active {
-        border-color: #4456fb;
-    }
-}
-</style>