From c3e044f6e902410b9dd782d92c85db907c7ef0bc Mon Sep 17 00:00:00 2001
From: wangzenghua <1048523306@qq.com>
Date: Mon, 24 Mar 2025 04:14:57 +0100
Subject: [PATCH] fix
---
.../component/landsManage/index.vue | 4 +-
.../views/plantingAndBreeding/base/index.vue | 78 ++++++++++---------
2 files changed, 45 insertions(+), 37 deletions(-)
diff --git a/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue b/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue
index 8d18cfa..886725c 100644
--- a/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue
+++ b/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue
@@ -611,11 +611,11 @@ function newTree(arr, i) {
arr.forEach((v) => {
if (i == 0) {
v.value = v.id;
- v.label = v.prentLandType;
+ v.label = v.landType;
v.disabled = !v.children || !v.children.length;
} else {
v.value = v.id;
- v.label = v.childLandCategory;
+ v.label = v.landType;
}
if (v.children) v.children = newTree(v.children, i + 1);
});
diff --git a/sub-government-affairs-service/src/views/plantingAndBreeding/base/index.vue b/sub-government-affairs-service/src/views/plantingAndBreeding/base/index.vue
index 6df4b11..2517bdb 100644
--- a/sub-government-affairs-service/src/views/plantingAndBreeding/base/index.vue
+++ b/sub-government-affairs-service/src/views/plantingAndBreeding/base/index.vue
@@ -2,7 +2,7 @@
-
+
-
批量删除
@@ -47,20 +46,21 @@ import { useRouter } from 'vue-router';
import { useApp } from '@/hooks';
import { useUserStore } from '@/store/modules/user';
import { CRUD_OPTIONS } from '@/config';
-import { isEmpty, mockData, sleep } from '@/utils';
+import { isEmpty, mockData, sleep, setDicData } from '@/utils';
+import { getLandsList } from '@/apis/land';
const { VITE_APP_BASE_API, VITE_APP_NAME } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const router = useRouter();
const crudRef = ref(null);
-const landTypeData = ref([
+const treeData = ref([
{
label: '基地分类',
- id: '0',
+ id: null,
children: [
- { label: '种植基地', id: '01', children: [], pId: '0' },
- { label: '养殖基地', id: '02', children: [], pId: '0' },
+ { label: '种植基地', id: '1', children: [], pid: null },
+ { label: '养殖基地', id: '2', children: [], pid: null },
],
},
]);
@@ -114,38 +114,31 @@ const state = reactive({
label: '地块名',
prop: 'landName',
width: 200,
- formslot: true,
+ type: 'select',
+ props: {
+ label: 'landName',
+ value: 'id',
+ },
+ dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=20`,
+ dicHeaders: {
+ authorization: UserStore.token,
+ },
+ dicFormatter: (res) => res.data?.records ?? [],
+ filterable: true,
+ remote: true,
+ clearable: true,
+ remoteMethod: (val) => remoteLandList(val),
+ change: (val) => selectedChange(val),
rules: {
required: true,
- message: '请输入',
+ message: '请选择',
trigger: 'blur',
},
+ // addDisplay: true,
+ // editDisplay: true,
+ // viewDisplay: false,
+ // overHidden: true,
},
- // {
- // label: '地块名',
- // prop: 'p2',
- // width: 200,
- // type: 'select',
- // // addDisplay: true,
- // // editDisplay: true,
- // // viewDisplay: false,
- // // props: {
- // // label: 'areaName',
- // // value: 'areaCode',
- // // children: 'areaChildVOS',
- // // },
- // // dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
- // // dicHeaders: {
- // // authorization: UserStore.token,
- // // },
- // // dicFormatter: (res) => res.data ?? [],
- // rules: {
- // required: true,
- // message: '请选择',
- // trigger: 'blur',
- // },
- // overHidden: true,
- // },
{
label: '区域位置',
prop: 'p3',
@@ -284,7 +277,7 @@ const loadData = async () => {
state.data = mockData(
{
p1: '耿马镇一号基地',
- p2: '耿马镇2025001号地块',
+ landName: '耿马镇2025001号地块',
p3: '耿马傣族佤族自治县/耿马镇',
p4: '1000',
p5: '张三',
@@ -418,4 +411,19 @@ const onDel = (rows = []) => {
const rowDel = (row, index, done) => {
onDel([row]);
};
+
+// 远程搜搜
+const remoteLandList = async (val) => {
+ if (isEmpty(val)) return;
+ const query = { landName: val, current: 1, size: 20 };
+ const res = await getLandsList(query);
+ if (res.code === 200) {
+ setDicData(state.options.column, 'landName', res.data.records);
+ }
+};
+
+// 选择赋值
+const selectedChange = ({ value, item }) => {
+ console.log(430, value, item, item.landName, item.address, item.area);
+};