swyq-detail.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="ksqulc">
  3. <z-paging ref="paging" bgColor="#F7F7F7" safe-area-inset-bottom paging-class="paging-btm-shadow" refresher-only @onRefresh="onRefresh" scroll-with-animation>
  4. <template #top>
  5. <ut-navbar title="获评信息详情" :fixed="false" border></ut-navbar>
  6. </template>
  7. <view v-if="form?.swyqRes == '2'" class="pd-24 c-#FC333F f-s-24 bg-#F8E7E8">审核不通过理由:{{form?.msg}}</view>
  8. <view class="p-rtv">
  9. <!-- 基本信息 -->
  10. <image v-if="form?.res !== '0'" class="gap_res_image w-160 h-160" :src="`/static/images/common/base_res_logo${form.swyqRes}.png`" mode="widthFix" />
  11. <view class="pd-24 bg-#fff mb-10">
  12. <view class="f-s-30 pd2-16-0 info-border-bottom">
  13. <span class="c-#666">获评类型:</span>
  14. <span class="c-#333">三无一全</span>
  15. </view>
  16. <view class="f-s-30 pd2-16-0 info-border-bottom">
  17. <span class="c-#666">获评品种:</span>
  18. <span class="c-#333">{{ form?.swyqVarietyName || '-' }}</span>
  19. </view>
  20. <view class="f-s-30 pd2-16-0 info-border-bottom">
  21. <span class="c-#666">获评日期:</span>
  22. <span class="c-#333">{{ form?.swyqRatedDate || '-' }}</span>
  23. </view>
  24. <view v-if="form?.swyqCertFile" class="f-s-30 pd2-16-0 info-border-bottom">
  25. <view class="f-s-30 c-#666 mb-10">官方公示证明材料</view>
  26. <ut-album :urls="form?.swyqCertFile"></ut-album>
  27. </view>
  28. <view v-if="form?.swyqUrl" class="f-s-30 pd2-16-0 info-border-bottom">
  29. <span class="c-#666">官方公示网址:</span>
  30. <span class="c-#333">{{ form?.swyqUrl || '-' }}</span>
  31. </view>
  32. <view class="f-s-30 pd2-16-0 info-border-bottom">
  33. <span class="c-#666">基地名称:</span>
  34. <span class="c-#333">{{ form?.baseName || '-' }}</span>
  35. </view>
  36. <view class="f-s-30 pd2-16-0 info-border-bottom">
  37. <span class="c-#666">基地类型:</span>
  38. <span class="c-#333">{{ selectDictLabel(pt_base_type, form?.baseType) || '-' }}</span>
  39. </view>
  40. <view class="f-s-30 pd2-16-0 info-border-bottom">
  41. <span class="c-#666">基地所在地区:</span>
  42. <span class="c-#333">{{ form?.gapInfo?.adcodeName || '-' }}</span>
  43. </view>
  44. <view class="f-s-30 pd2-16-0 info-border-bottom">
  45. <span class="c-#666">详细地址:</span>
  46. <span class="c-#333">{{ form?.gapInfo?.address || '-' }}</span>
  47. </view>
  48. <view class="f-s-30 pd2-16-0 info-border-bottom">
  49. <view class="f-s-30 c-#666 mb-10">基地范围:</view>
  50. <view class="bg-#f7f7f7 d-flex ov-hd p-rtv">
  51. <image class="w-full" v-if="form?.gapInfo?.basePic" :src="form?.gapInfo?.basePic" mode="widthFix" @click="previewBasePic"></image>
  52. <view v-else class="w-full h-120 d-flex a-c j-c c-999">暂无基地范围</view>
  53. </view>
  54. </view>
  55. <view class="f-s-30 pd2-16-0 info-border-bottom">
  56. <span class="c-#666">基地面积:</span>
  57. <span class="c-#333">{{ form?.gapInfo?.area || '-' }}{{ form?.gapInfo?.areaUnit || '亩' }}</span>
  58. </view>
  59. <view class="f-s-30 pd2-16-0 info-border-bottom">
  60. <span class="c-#666">基地经纬度:</span>
  61. <span class="c-#333">E{{ form?.gapInfo?.lng || '-' }}, N{{ form?.gapInfo?.lat || '-' }}</span>
  62. </view>
  63. </view>
  64. </view>
  65. <template v-if="form.swyqRes == '0'" #bottom>
  66. <view class="pd-20 d-flex">
  67. <up-button @click="passAudit" class="mr-30" type="primary">审核通过</up-button>
  68. <up-button @click="showNoPass = true" type="error">审核不通过</up-button>
  69. </view>
  70. </template>
  71. </z-paging>
  72. <ut-confirm-dialog v-model:show="showNoPass" width="680rpx">
  73. <view>
  74. <up-form ref="upFormNoPassRef" :model="formNoPass" :rules="noPassRules" labelWidth="auto" class="p-rtv" labelPosition="top">
  75. <up-form-item label="不通过原因" prop="msg" required>
  76. <up-textarea v-model="formNoPass.msg" :maxlength="200" placeholder="请输入不通过原因" auto-height></up-textarea>
  77. </up-form-item>
  78. </up-form>
  79. </view>
  80. <template #footer>
  81. <view class="d-flex j-c pd-30">
  82. <up-button @click="showNoPass = false" class="mr-30">取消</up-button>
  83. <up-button @click="noPassAudit" type="error">确认不通过</up-button>
  84. </view>
  85. </template>
  86. </ut-confirm-dialog>
  87. </view>
  88. </template>
  89. <script setup lang="ts">
  90. import { useClientRequest } from '@/utils/request';
  91. import { getUrlParams, recursiveDecodeURIComponent } from '@/utils/ruoyi';
  92. const props = defineProps({
  93. id: {
  94. type: String,
  95. default: '',
  96. },
  97. });
  98. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  99. const { pt_base_type } = toRefs<any>(proxy?.useDict('pt_base_type'));
  100. const paging = ref<any>(null);
  101. const form = ref<any>({});
  102. const did = ref('');
  103. // 获取详情(GAP获评信息)
  104. const getDetailById = async () => {
  105. if (!props.id) return;
  106. const res = await useClientRequest.get(`/plt-api/app/base/getInfoById/${props.id}`);
  107. if (res && res.code === 200) {
  108. form.value = res.data || {};
  109. }
  110. };
  111. const onRefresh = () => {
  112. getDetailById();
  113. paging.value?.complete();
  114. };
  115. onMounted(() => {
  116. getDetailById();
  117. });
  118. // 预览基地范围图片
  119. const previewBasePic = () => {
  120. const url = form.value?.gapInfo.basePic;
  121. if (!url) return;
  122. uni.previewImage({ urls: [url], current: 0 });
  123. };
  124. const passAudit = async () => {
  125. try {
  126. const res = await uni.showModal({
  127. title: '通过提示',
  128. content: '确认通过该基地审核吗?',
  129. confirmColor: '#37A954',
  130. confirmText: '确认',
  131. });
  132. if (!res.confirm && !res.content) return;
  133. await uni.showLoading({
  134. title: '通过中...',
  135. mask: true,
  136. });
  137. const resq: any = await useClientRequest.post(`/plt-api/app/base/approvalSwyq`, {
  138. targetId: props.id,
  139. res: '1',
  140. });
  141. if (!resq || resq.code !== 200) return;
  142. uni.hideLoading();
  143. uni.showToast({
  144. title: '操作成功',
  145. icon: 'success',
  146. });
  147. paging.value?.reload();
  148. uni.$emit('refreshSwyqListAudit');
  149. //返回上一页
  150. uni.navigateBack({
  151. delta: 1,
  152. });
  153. } catch (error) {
  154. console.error('通过基地审核失败:', error);
  155. }
  156. };
  157. const showNoPass = ref(false);
  158. const upFormNoPassRef = ref<any>(null);
  159. const noPassRules = {
  160. msg: [
  161. { required: true, message: '请输入不通过原因' },
  162. { min: 2, max: 200, message: '不通过原因长度在2到200个字符之间' },
  163. ],
  164. };
  165. const formNoPass = ref({
  166. msg: '',
  167. });
  168. const noPassAudit = async () => {
  169. try {
  170. const valid = await upFormNoPassRef.value?.validate();
  171. if (!valid) return;
  172. } catch (error) {
  173. return;
  174. }
  175. try {
  176. await uni.showLoading({
  177. title: '提交中...',
  178. mask: true,
  179. });
  180. await useClientRequest.post(`/plt-api/app/base/approvalSwyq`, {
  181. targetId: props.id,
  182. res: '2',
  183. ...formNoPass.value,
  184. });
  185. uni.hideLoading();
  186. uni.showToast({
  187. title: '操作成功',
  188. icon: 'success',
  189. });
  190. showNoPass.value = false;
  191. paging.value?.reload();
  192. uni.$emit('refreshSwyqBaseListAudit');
  193. //返回上一页
  194. uni.navigateBack({
  195. delta: 1,
  196. });
  197. } catch (error) {
  198. console.error('不通过基地审核失败:', error);
  199. }
  200. };
  201. </script>
  202. <style lang="scss" scoped>
  203. .z-paging-wrap {
  204. position: absolute;
  205. right: 0;
  206. top: 0;
  207. bottom: 0;
  208. left: 0;
  209. }
  210. .btn-aree-center {
  211. position: absolute;
  212. top: 0;
  213. right: 0;
  214. bottom: 0;
  215. left: 0;
  216. }
  217. .plot-item {
  218. border: 1rpx solid rgba($u-primary, 0.4);
  219. border-radius: 10rpx;
  220. }
  221. .gap-info-card {
  222. border: 1rpx solid rgba($u-primary, 0.4);
  223. }
  224. .gap_res_image {
  225. position: absolute;
  226. right: 30rpx;
  227. top: 30rpx;
  228. }
  229. </style>