基础信息维护

This commit is contained in:
lzc 2025-03-03 16:50:51 +08:00
parent 984d5f764a
commit c1224c10bd
8 changed files with 459 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import plantingAndBreedingRouter from './modules/plantingAndBreeding';
import landsRoutes from './modules/lands'; import landsRoutes from './modules/lands';
import annualplanRoutes from './modules/annualplan'; import annualplanRoutes from './modules/annualplan';
import statisticsRoutes from './modules/statistics'; import statisticsRoutes from './modules/statistics';
import dictRoutes from './modules/dict';
export const constantRoutes = [ export const constantRoutes = [
{ {
@ -47,6 +48,7 @@ export const constantRoutes = [
...annualplanRoutes, ...annualplanRoutes,
...landsRoutes, ...landsRoutes,
...statisticsRoutes, ...statisticsRoutes,
...dictRoutes,
]; ];
/** /**

View File

@ -0,0 +1,38 @@
import Layout from '@/layouts/index.vue';
const dictRoutes = [
{
path: '/sub-government-affairs-service/dict',
name: 'dict',
component: Layout,
redirect: '/sub-government-affairs-service/region',
meta: { title: '基础信息维护', icon: 'Document' },
children: [
{
path: '/sub-government-affairs-service/region',
name: 'region',
component: () => import('@/views/dict/component/region/index.vue'),
meta: { title: '行政区域信息', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/landCassification',
name: 'landCassification',
component: () => import('@/views/dict/component/landCassification/index.vue'),
meta: { title: '土地分类', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/dictCrop',
name: 'dictCrop',
component: () => import('@/views/dict/component/dictCrop/index.vue'),
meta: { title: '种植产物信息', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/soilClassification',
name: 'soilClassification',
component: () => import('@/views/dict/component/soilClassification/index.vue'),
meta: { title: '土壤分类', icon: 'Document' },
},
],
},
];
export default dictRoutes;

View File

@ -1,3 +1,166 @@
<template> <template>
<div>网格种植进度</div> <div class="custom-page">
<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-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menu-left>
<el-button type="success" icon="download" @click="onExport">导出</el-button>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</div>
</template> </template>
<script setup>
import { reactive, ref } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import { compact } from 'lodash';
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity, ExportEntity } from '@/apis/grid';
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
const handleLandChange = async (value, form, done) => {
if (!value) return; //
state.form.address = value.item?.address || '';
};
const JobTypeChange = async (value, form, done) => {
if (!value) return;
state.form.productName = value.item?.productName || '';
};
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
addBtnText: '',
addBtn: false,
column: [
{ label: '网格名称', prop: 'gridManager' },
{ label: '网格管理员', prop: 'gridManager' },
{ label: '联系方式', prop: 'gridManager' },
{ label: '网格名称', prop: 'gridManager' },
{ label: '网格名称', prop: 'gridManager' },
{ label: '种植总面积(亩)', prop: 'gridManager' },
{ label: '已种植总面积(亩)', prop: 'gridManager' },
{ label: '进度(%)', prop: 'gridManager' },
],
actions: [],
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
//
const loadData = () => {
// 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;
// });
};
loadData();
//
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 onExport = () => {
if (isEmpty(state.data)) {
app.$message.error('当前暂时没有可供导出的数据!');
return;
}
state.loading = true;
const fileName = '网格种植记录明细表';
// ExportEntity(state.query)
// .then((res) => {
// if (res.status === 200) {
// downloadFile(res.data, `${fileName}.xlsx`, 'blob');
// app.$message.success('');
// }
// })
// .catch((err) => {
// app.$message.error('');
// })
// .finally(() => {
// state.loading = false;
// });
};
</script>

View File

@ -0,0 +1,65 @@
<template>
<div>
<el-row :gutter="20">
<el-col :span="6">
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" />
</el-col>
<el-col :span="18"></el-col>
</el-row>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive } from 'vue';
/* --------------- data --------------- */
// #region
let typeTree = reactive([
{
label: 'Level one 1',
children: [
{
label: 'Level two 1-1',
children: [
{
label: 'Level three 1-1-1',
},
],
},
],
},
{
label: 'Level one 2',
children: [
{
label: 'Level two 2-1',
children: [
{
label: 'Level three 2-1-1',
},
],
},
{
label: 'Level two 2-2',
children: [
{
label: 'Level three 2-2-1',
},
],
},
],
},
]);
// #endregion
/* --------------- methods --------------- */
const handleNodeClick = (data) => {
console.log(data);
};
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,165 @@
<template>
<CustomCard>
<el-row :gutter="20">
<el-col :span="6">
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" />
</el-col>
<el-col :span="18">
<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-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menu-left>
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
<el-button type="success" icon="download" @click="onExport">导出</el-button>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</el-col>
</el-row>
</CustomCard>
</template>
<script lang="ts" setup>
import { useApp } from '@/hooks';
import { ref, reactive } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS } from '@/config';
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
/* --------------- data --------------- */
// #region
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
addBtnText: '',
addBtn: false,
column: [
{ label: '编号', prop: 'gridManager' },
{ label: '土地分类', prop: 'gridManager' },
{ label: '土地类别', prop: 'gridManager' },
{ label: '状态', prop: 'gridManager' },
],
actions: [
{
name: (row) => getStatusButtonText(row.status),
icon: 'edit',
event: ({ row }) => rowStatus(row),
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => rowEdit(row),
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
],
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
let typeTree = reactive([
{
label: 'Level one 1',
children: [
{
label: 'Level two 1-1',
children: [
{
label: 'Level three 1-1-1',
},
],
},
],
},
{
label: 'Level one 2',
children: [
{
label: 'Level two 2-1',
children: [
{
label: 'Level three 2-1-1',
},
],
},
{
label: 'Level two 2-2',
children: [
{
label: 'Level three 2-2-1',
},
],
},
],
},
]);
// #endregion
/* --------------- methods --------------- */
const handleNodeClick = (data) => {
console.log(data);
};
//
const rowStatus = (row) => {
console.info('操作状态');
};
const rowDel = (row) => {};
const getStatusButtonText = (status) => {
switch (status) {
case 'active':
return '启用';
case 'inactive':
return '禁用';
}
};
const rowEdit = () => {};
const onAdd = () => {};
const onExport = () => {};
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,3 @@
<template>
<div>行政区域信息</div>
</template>

View File

@ -0,0 +1,3 @@
<template>
<div>土壤分类</div>
</template>

View File

@ -0,0 +1,19 @@
<template>
<router-view></router-view>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>