This commit is contained in:
wangzenghua 2025-03-19 09:09:38 +01:00
parent cc89de2a36
commit 334e41efca
8 changed files with 453 additions and 26 deletions

View File

@ -4,6 +4,7 @@ VITE_APP_TITLE = '数字农业产业管理平台'
VITE_APP_SUB_OS = '//192.168.18.99:88/sub-operation-service/'
VITE_APP_SUB_ADMIN = '//192.168.18.99:88/sub-admin/'
VITE_APP_SUB_GAS = '//192.168.18.99:88/sub-government-affairs-service/'
VITE_APP_SUB_GSS = '//192.168.18.99:88/sub-government-screen-service/'
# 接口
VITE_APP_BASE_API = '/apis'
VITE_APP_BASE_URL = ''

View File

@ -4,6 +4,7 @@ VITE_APP_TITLE = '数字农业产业管理平台'
VITE_APP_SUB_OS = '//localhost:8090/sub-operation-service/'
VITE_APP_SUB_ADMIN = '//localhost:8090/sub-admin/'
VITE_APP_SUB_GAS = '//localhost:8090/sub-government-affairs-service/'
VITE_APP_SUB_GSS = '//localhost:8090/sub-government-screen-service/'
# 接口
VITE_APP_BASE_API = '/apis'
VITE_APP_BASE_URL = ''

View File

@ -14,7 +14,7 @@ import { usePermissionStore } from '@/store/modules/permission';
NProgress.configure({ showSpinner: false });
const { VITE_APP_TITLE } = import.meta.env;
const whiteList = ['/login'];
const whiteList = ['/login', '/sub-government-affairs-service/trace-info'];
router.beforeEach(async (to, from, next) => {
NProgress.start();

View File

@ -33,12 +33,12 @@ export default [
component: () => import('@/views/plantingAndBreeding/epidemicDisease/index.vue'),
meta: { title: '疫病监测信息', icon: 'Document' },
},
// {
// path: '/sub-government-affairs-service/breeding-base-information',
// name: 'breeding-base-information',
// component: () => import('@/views/plantingAndBreeding/base/index.vue'),
// meta: { title: '种养殖基地', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/breeding-base-information',
name: 'breeding-base-information',
component: () => import('@/views/plantingAndBreeding/base/index.vue'),
meta: { title: '种养殖基地', icon: 'Document' },
},
],
},
];

View File

@ -1,6 +1,411 @@
<template>
<div class="custom-page">种养殖基地信息</div>
<div class="custom-page">
<el-row :gutter="20">
<el-col :span="4">
<custom-table-tree title="种养殖基地分类" :data="landTypeData" @node-click="onNodeClick" />
</el-col>
<el-col :span="20">
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:search="state.query"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@search-reset="searchChange"
@search-change="searchChange"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@row-del="rowDel"
@row-save="rowSave"
@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>
<template #status="{ row }">
<el-tag v-if="row.status == 1" type="success" size="small">启用</el-tag>
<el-tag v-if="row.status == 0" type="danger" size="small">禁用</el-tag>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</el-col>
</el-row>
</div>
</template>
<script setup>
import { ref, computed, watch } from 'vue';
import { ref, reactive } from 'vue';
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';
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([
{
label: '基地分类',
id: '0',
children: [
{ label: '种植基地', id: '01', children: [], pId: '0' },
{ label: '养殖基地', id: '02', children: [], pId: '0' },
],
},
]);
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
addBtnText: '添加',
// addBtn: false,
selection: true,
column: [
{
label: '基地名称',
prop: 'p1',
search: true,
width: 200,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
overHidden: true,
},
{
label: '地块名',
prop: 'p2',
width: 200,
type: 'cascader',
// hide: true,
// 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',
width: 200,
overHidden: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '区域面积',
prop: 'p4',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '基地分类',
prop: 'type',
type: 'select',
dicData: [
{
label: '种植基地',
value: 1,
},
{
label: '养殖基地',
value: 2,
},
],
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '状态',
prop: 'status',
type: 'select',
dicData: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '负责人',
prop: 'p5',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '联系电话',
prop: 'p6',
width: 150,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '创建时间',
prop: 'createTime',
width: 150,
// search: true,
display: false,
},
{
label: '更新时间',
prop: 'updateTime',
width: 150,
display: false,
},
],
actions: [
{
name: '查看',
icon: 'view',
event: ({ row }) => rowView(row),
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => rowEdit(row),
},
// {
// type: 'success',
// name: ({ row }) => {
// return row.status === 1 ? '' : '';
// },
// icon: ({ row }) => {
// return row.status === 1 ? 'turnOff' : 'open';
// },
// event: ({ row }) => rowStatus(row),
// },
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
],
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
const loadData = async () => {
//state.loading = true;
// GetEntityList(state.query)
// .then((res) => {
// if (res.code === 200) {
// const { current, size, total, records } = res.data;
// state.data = records;
// state.pageData = {
// currentPage: current || 1,
// pageSize: size || 10,
// total: total,
// };
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// state.data = [];
// })
// .finally(() => {
// state.loading = false;
// });
state.loading = true;
await sleep(500);
state.data = mockData(
{
p1: '202501基地',
p2: '耿马镇1号地块',
p3: '耿马傣族佤族自治县/耿马镇',
p4: '1000',
p5: '张三',
p6: '13837633838',
status: 1,
type: 1,
createTime: '2025-01-01',
updateTime: '2025-01-15',
},
10
);
state.loading = false;
};
loadData();
const onNodeClick = (data) => {
console.log('onNodeClick', data);
};
//
const currentChange = (current) => {
state.query.current = current;
loadData();
};
//
const sizeChange = (size) => {
state.query.size = size;
loadData();
};
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
state.query.current = 1;
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
//
const rowView = (row) => {
crudRef.value.rowView(row);
};
//
const rowStatus = (row) => {
console.info('操作状态');
};
//
const onAdd = () => {
crudRef.value && crudRef.value.rowAdd();
};
const rowSave = (row, done, loading) => {
// AddEntity(row)
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// done();
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// })
// .finally(() => {
// loading();
// });
};
//
const rowEdit = (row) => {
crudRef.value && crudRef.value.rowEdit(row);
};
const rowUpdate = (row, index, done, loading) => {
// UpdateEntity(row)
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// done();
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// })
// .finally(() => {
// loading();
// });
};
//
const onDel = (rows = []) => {
if (isEmpty(rows)) return;
const ids = rows.map((item) => item.id);
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
// DeleteEntity({ ids: ids.join(',') })
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// });
})
.catch(() => {});
};
const rowDel = (row, index, done) => {
onDel([row]);
};
</script>

View File

@ -56,16 +56,26 @@ const landTypeData = ref([
id: '0',
children: [
{ label: '耕地', id: '01', children: [], pId: '0' },
{ label: '园地', children: [], id: '02', pId: '0' },
{ label: '林地', children: [], id: '02', pId: '0' },
{ label: '草地', children: [], id: '03', pId: '0' },
{ label: '农田水利用地', children: [], id: '04', pId: '0' },
{ label: '养殖水面', children: [], id: '05', pId: '0' },
],
},
{
label: '建设用地',
id: '1',
children: [{ label: '城乡建设用地', children: [], id: '11', pId: '10' }],
children: [
{ label: '城乡住宅用地', children: [], id: '11', pId: '10' },
{ label: '公共设施用地', children: [], id: '11', pId: '10' },
{ label: '工矿仓储用地', children: [], id: '11', pId: '10' },
{ label: '交通水利设施用地', children: [], id: '11', pId: '10' },
{ label: '旅游用地', children: [], id: '11', pId: '10' },
{ label: '军事设施用地', children: [], id: '11', pId: '10' },
],
},
{
label: '住宅用地',
label: '未利用地',
id: '2',
children: [],
},

View File

@ -109,16 +109,16 @@ const UserStore = useUserStore();
const router = useRouter();
const crudRef = ref(null);
const landTypeData = ref([
{
label: '疫病分类',
id: '0',
children: [
// {
// label: '',
// id: '0',
// children: [
{ label: '家禽类', id: '01', children: [], pId: '0' },
{ label: '家畜类', id: '02', children: [], pId: '0' },
{ label: '水产类', id: '03', children: [], pId: '0' },
{ label: '特种养殖类', id: '04', children: [], pId: '0' },
],
},
// ],
// },
]);
const state = reactive({
loading: false,

View File

@ -53,16 +53,26 @@ const landTypeData = ref([
id: '0',
children: [
{ label: '耕地', id: '01', children: [], pId: '0' },
{ label: '园地', children: [], id: '02', pId: '0' },
{ label: '林地', children: [], id: '02', pId: '0' },
{ label: '草地', children: [], id: '03', pId: '0' },
{ label: '农田水利用地', children: [], id: '04', pId: '0' },
{ label: '养殖水面', children: [], id: '05', pId: '0' },
],
},
{
label: '建设用地',
id: '1',
children: [{ label: '城乡建设用地', children: [], id: '11', pId: '10' }],
children: [
{ label: '城乡住宅用地', children: [], id: '11', pId: '10' },
{ label: '公共设施用地', children: [], id: '11', pId: '10' },
{ label: '工矿仓储用地', children: [], id: '11', pId: '10' },
{ label: '交通水利设施用地', children: [], id: '11', pId: '10' },
{ label: '旅游用地', children: [], id: '11', pId: '10' },
{ label: '军事设施用地', children: [], id: '11', pId: '10' },
],
},
{
label: '住宅用地',
label: '未利用地',
id: '2',
children: [],
},