Explorar el Código

修改基地信息

huangxw hace 1 semana
padre
commit
292e34f680

+ 4 - 2
src/audit/plant/base/audit-detail/models/gap-detail.vue

@@ -137,10 +137,11 @@ const passAudit = async () => {
             title: '通过中...',
             mask: true,
         });
-        await useClientRequest.post(`/plt-api/app/gapCertificationInfo/approveGapBaseApproval`, {
+        const resq = await useClientRequest.post(`/plt-api/app/gapCertificationInfo/approveGapBaseApproval`, {
             targetId: props.id,
             res: '1',
         });
+        if (!resq || resq.code !== 200) return;
         uni.hideLoading();
         uni.showToast({
             title: '操作成功',
@@ -180,11 +181,12 @@ const noPassAudit = async () => {
             title: '提交中...',
             mask: true,
         });
-        await useClientRequest.post(`/plt-api/app/gapCertificationInfo/approveGapBaseApproval`, {
+        const res = await useClientRequest.post(`/plt-api/app/gapCertificationInfo/approveGapBaseApproval`, {
             targetId: props.id,
             res: '2',
             ...formNoPass.value,
         });
+        if (!res || res !== 200) return;
         uni.hideLoading();
         uni.showToast({
             title: '操作成功',

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

@@ -137,10 +137,11 @@ const passAudit = async () => {
             title: '通过中...',
             mask: true,
         });
-        await useClientRequest.post(`/plt-api/app/base/approvalSwyq`, {
+         const resq: any = await useClientRequest.post(`/plt-api/app/base/approvalSwyq`, {
             targetId: props.id,
             res: '1',
         });
+        if (!resq || resq.code !== 200) return;
         uni.hideLoading();
         uni.showToast({
             title: '操作成功',
@@ -192,7 +193,7 @@ const noPassAudit = async () => {
         });
         showNoPass.value = false;
         paging.value?.reload();
-        uni.$emit('refreshSwyqListAudit');
+        uni.$emit('refreshSwyqBaseListAudit');
         //返回上一页
         uni.navigateBack({
             delta: 1,

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

@@ -84,7 +84,7 @@ const placeholder = ref('搜企业、基地名称、品种');
 const tabs = ref([
     { label: '全部', value: '' },
     { label: '审核通过', value: '1' },
-    { label: '审核通过', value: '2' },
+    { label: '审核通过', value: '2' },
     { label: '待审核', value: '0' },
 ]);
 const form = ref({

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

@@ -2,7 +2,7 @@
     <z-paging class="" ref="paging" bgColor="#fff" paging-class="paging-btm-shadow" safe-area-inset-bottom
         scroll-with-animation>
         <template #top>
-            <ut-navbar title="添加GAP基地信息" :fixed="false" border></ut-navbar>
+            <ut-navbar :title="did ? '编辑GAP基地信息' : '添加GAP基地信息'" :fixed="false" border></ut-navbar>
         </template>
         <view class="pd-24">
             <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
@@ -75,13 +75,17 @@
                         </template>
                     </up-form-item>
                     <!-- 基地经纬度 -->
-                    <view class="h-1" id="lnglatpppp"></view>
-                    <up-form-item required label="基地经纬度" prop="lnglat">
-                        <view class="flex1 d-flex a-c">
-                            <up-input v-model="form.lng" border="bottom" placeholder="70-150内的经度数值"
-                                clearable></up-input>
+                      <view class="h-1" id="lngpppp"></view>
+                    <view class="h-1" id="latpppp"></view>
+                    <up-form-item required label="基地经纬度" class="form-item-wrap-column">
+                        <view class="d-flex" style="margin-top: -10px">
+                            <up-form-item prop="gapInfo.lng">
+                                <up-input v-model="form.lng" border="bottom" placeholder="70-150内的经度数值" clearable></up-input>
+                            </up-form-item>
                             <view class="pd-5"></view>
-                            <up-input v-model="form.lat" placeholder="4-53内的纬度数值" border="bottom" clearable></up-input>
+                            <up-form-item prop="gapInfo.lat">
+                                <up-input v-model="form.lat" placeholder="4-53内的纬度数值" border="bottom" clearable></up-input>
+                            </up-form-item>
                         </view>
                     </up-form-item>
                     <!-- 校验定位:建设时间 -->
@@ -163,53 +167,12 @@ const rules = reactive({
     basePic: [{ required: true, message: '请绘制基地范围' }],
     adcode: [{ required: true, message: '请选择基地具体地址' }],
     area: [{ required: true, message: '请输入基地面积' }],
-    lnglat: [
-        { required: true, message: '请输入基地经纬度' },
-        {
-            validator: (_rule: any, value: any) => {
-                const lng = parseFloat(form.value.lng);
-                const lat = parseFloat(form.value.lat);
-                if (isNaN(lng) || lng < 70 || lng > 150) {
-                    return Promise.reject('经度请输入70-150内的数值');
-                }
-                if (isNaN(lat) || lat < 4 || lat > 53) {
-                    return Promise.reject('纬度请输入4-53内的数值');
-                }
-                return Promise.resolve();
-            },
-            trigger: 'blur',
-        }
-    ],
     ratedDate: [{ required: true, message: '请选择获评GAP基地时间' }],
     certFile: [{ required: true, message: '请上传官方公示证明材料' }],
     url: [{ required: true, message: '请输入官方公示网址' }],
 
 });
-// saveInfo和submitForm防抖
-// 暂存基地信息
-const saveBaseInfo = async () => {
-    uni.$u.debounce(
-        async () => {
-            // 提交表单
-            uni.showLoading({
-                title: '保存中...',
-            });
-            try {
-                const res = await useClientRequest.post('/plt-api/app/base/temp', form.value);
-                uni.hideLoading();
-                if (!res || res !== 200) return;
-                uni.showToast({
-                    title: '保存成功',
-                    icon: 'success',
-                });
-            } catch (error) {
-                uni.hideLoading();
-            }
-        },
-        500,
-        true
-    );
-};
+
 const submitForm = async () => {
     uni.$u.debounce(
         async () => {
@@ -226,7 +189,7 @@ const submitForm = async () => {
                 title: '提交中...',
             });
             try {
-                const res = await useClientRequest.post('/plt-api/app/gapCertificationInfo/add', form.value);
+                const res = did.value ? await useClientRequest.post(`/plt-api/app/gapCertificationInfo/update`, form.value) : await useClientRequest.post('/plt-api/app/gapCertificationInfo/add', form.value);
                 uni.hideLoading();
                 if (!res || res !== 200) return;
                 uni.hideLoading();
@@ -302,8 +265,22 @@ const selectMedicine = () => {
 const confirmArea = (area: any) => {
     form.value.adcodeName = area.fullName;
 };
+const getDetailById = async (id: string) => {
+    if (!id) return;
+    const res = await useClientRequest.get(`/plt-api/app/gapCertificationInfo/getInfoById/${id}`);
+    if (res && res.code === 200) {
+        form.value = {
+            ...res.data,
+            lnglat: res.data.lng + ',' + res.data.lat,
+        };
+    }
+};
+const did = ref('');
 onLoad((optins: any) => {
     if (optins.id) {
+        // 编辑加载详
+        did.value = optins.id;
+        getDetailById(optins.id);
     } else {
         getLocationByAddress();
     }

+ 1 - 1
src/plant/base/gap-base-info/index.vue

@@ -86,7 +86,7 @@ const placeholder = ref('搜基地名称、品种、基地地址');
 const tabs = ref([
     { label: '全部', value: '' },
     { label: '有效', value: '1' },
-    { label: '审核通过', value: '2' },
+    { label: '审核通过', value: '2' },
     { label: '待审核', value: '0' },
 ]);
 // 判断是否是云南的企业

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

@@ -66,7 +66,7 @@
             </view>
             <template v-if="form?.baseInfo?.swyqRes == '2'" #bottom>
                 <view class="pd-20">
-                    <view></view>
+                    <view v-if="form?.baseInfo?.msg" class="mb-16 c-#FC333F f-s-24">审核未通过原因:{{ form?.baseInfo?.msg || '-' }}</view>
                     <up-button type="primary" @click="$u.route({ type: 'redirect', url: '/plant/base/mark-swyq-base/index', params: { id: did } })">去修改</up-button>
                 </view>
             </template>

+ 5 - 6
src/plant/base/mark-swyq-base/index.vue

@@ -168,8 +168,6 @@ const submitForm = async () => {
             try {
                 await upFormRef.value?.validate();
             } catch (error: any) {
-                console.log(error);
-                
                 // 滚动到第一个错误字段
                 const firstErrorField = error && error[0].prop + 'pppp';
                 paging.value?.scrollIntoViewById(firstErrorField, 30, true);
@@ -180,12 +178,13 @@ const submitForm = async () => {
                 title: '提交中...',
             });
             try {
-                const res = await useClientRequest.post('/plt-api/app/base/addSwyqBase', {
+                const res = did.value ?  await useClientRequest.post('/plt-api/app/base/updateSwyqBase', {
                     ...formSwyq.value,
                     id: did.value,
+                }) : await useClientRequest.post('/plt-api/app/base/addSwyqBase', {
+                    ...formSwyq.value,
                 });
-                uni.hideLoading();
-                if (!res || res !== 200) return;
+                if (!res || res.code !== 200) return;
                 uni.hideLoading();
                 uni.showToast({
                     title: '提交成功',
@@ -203,7 +202,7 @@ const submitForm = async () => {
                     },
                 });
             } catch (error) {
-                uni.hideLoading();
+                
             }
         },
         500,