fix
This commit is contained in:
parent
4bd8c7222f
commit
c3e044f6e9
@ -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);
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="custom-page">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="4">
|
||||
<custom-table-tree title="种养殖基地分类" :data="landTypeData" @node-click="onNodeClick" />
|
||||
<custom-table-tree title="种养殖基地分类" :data="treeData" @node-click="onNodeClick" />
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<avue-crud
|
||||
@ -24,7 +24,6 @@
|
||||
@row-update="rowUpdate"
|
||||
>
|
||||
<template #menu-left>
|
||||
<!-- <el-button type="primary" icon="plus" @click="rowAdd">添加</el-button> -->
|
||||
<el-button type="danger" icon="delete" @click="onDel(state.selection)">批量删除</el-button>
|
||||
</template>
|
||||
|
||||
@ -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);
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user