This commit is contained in:
wangzenghua 2025-03-11 09:46:21 +01:00
commit 464f49094e
10 changed files with 1539 additions and 149 deletions

View File

@ -6,7 +6,7 @@
<template v-for="item in actions" :key="item.name"> <template v-for="item in actions" :key="item.name">
<el-dropdown-item v-if="onPermission(item)" @click="item.event(data)"> <el-dropdown-item v-if="onPermission(item)" @click="item.event(data)">
<el-button :type="item.type ?? 'primary'" :icon="formatterIcon(item)" :size="item.size" :disabled="item.disabled" text> <el-button :type="item.type ?? 'primary'" :icon="formatterIcon(item)" :size="item.size" :disabled="item.disabled" text>
{{ item.name || item.formatter(data) }} {{ formatterName(item) }}
</el-button> </el-button>
</el-dropdown-item> </el-dropdown-item>
</template> </template>
@ -27,6 +27,10 @@ const onPermission = (row) => {
return typeof row.auth === 'function' ? row.auth(props.data) : row.auth; return typeof row.auth === 'function' ? row.auth(props.data) : row.auth;
}; };
const formatterName = (row) => {
return typeof row.name === 'function' ? row.name(props.data) : row.name;
};
const formatterIcon = (row) => { const formatterIcon = (row) => {
return typeof row.icon === 'function' ? row.icon(props.data) : row.icon; return typeof row.icon === 'function' ? row.icon(props.data) : row.icon;
}; };

View File

@ -0,0 +1,33 @@
import request from '@/utils/axios';
//基础信息维护——字典项管理
//种植产物相关
export function getPlanType(params = {}) {
return request('land-resource/baseInfo/planTypePage', {
method: 'GET',
params,
});
}
export function savePlanType(data) {
return request('land-resource/baseInfo/planTypeSave', {
method: 'POST',
data,
});
}
export function upPlanType(data = {}) {
return request('land-resource/baseInfo/planTypeEdit', {
method: 'PUT',
data,
});
}
export function exportPlanType(params = {}) {
return request('/land-resource/baseInfo/planTypeExport', {
method: 'GET',
params,
responseType: 'blob',
});
}

View File

@ -25,3 +25,11 @@ export function CommonUpload(data, params) {
params, params,
}); });
} }
//云南省所有区域信息
export function getRegion(code) {
let codeVal = code ? code : '530000';
return request('/system/area/region?areaCode=' + codeVal, {
method: 'GET',
});
}

View File

@ -5,9 +5,15 @@ export default [
path: '/sub-government-affairs-service/productOperateMain', path: '/sub-government-affairs-service/productOperateMain',
name: 'productOperateMain', name: 'productOperateMain',
component: Layout, component: Layout,
redirect: '/sub-government-affairs-service/individual', redirect: '/sub-government-affairs-service/home',
meta: { title: '生产经营主体', icon: 'icon-shop' }, meta: { title: '生产经营主体', icon: 'icon-shop' },
children: [ children: [
{
path: '/sub-government-affairs-service/home',
component: () => import('@/views/productOperateMain/home/index.vue'),
name: 'home',
meta: { title: '数据可视化管理', icon: 'Document' },
},
{ {
path: '/sub-government-affairs-service/individual', path: '/sub-government-affairs-service/individual',
component: () => import('@/views/productOperateMain/individual/index.vue'), component: () => import('@/views/productOperateMain/individual/index.vue'),

View File

@ -23,7 +23,8 @@
</template> </template>
<template #status="{ row }"> <template #status="{ row }">
{{ !row.status ? '是' : '否' }} <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>
<template #menu="scope"> <template #menu="scope">
@ -73,37 +74,13 @@ import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils'; import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { compact } from 'lodash'; import { compact } from 'lodash';
import { import { getPlanType, savePlanType, upPlanType, exportPlanType } from '@/apis/baseInfo';
getOperationRecord,
saveOperationRecord,
editOperationRecord,
delOperationRecord,
exportOperationRecord,
getAddrCropByLand,
importOperationRecord,
} from '@/apis/land';
const { VITE_APP_BASE_API } = import.meta.env; const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp(); const app = useApp();
const UserStore = useUserStore(); const UserStore = useUserStore();
const crudRef = ref(null); const crudRef = ref(null);
const stateCrudRef = ref(null); const stateCrudRef = ref(null);
const handleLandChange = async (value, form, done) => {
if (!value || !value.item || !value.item.id) return; //
let val = {};
getAddrCropByLand(value.item?.id || '')
.then((res) => {
if (res.code === 200) {
val = res.data || {};
}
})
.catch((err) => {
val = {};
})
.finally(() => {});
state.form.crop = val?.crop || value.item?.crop;
state.form.address = val?.county + val?.town + val?.village || value.item?.address;
};
const stageOptions = reactive([ const stageOptions = reactive([
{ value: '0', label: '苗期' }, { value: '0', label: '苗期' },
@ -131,10 +108,11 @@ const state = reactive({
options: { options: {
...CRUD_OPTIONS, ...CRUD_OPTIONS,
addBtnText: '新增', addBtnText: '新增',
selection: false,
column: [ column: [
{ {
label: '编号', label: '编号',
prop: 'executor', prop: 'id',
fixed: true, fixed: true,
addDisplay: false, addDisplay: false,
editDisabled: true, editDisabled: true,
@ -147,8 +125,7 @@ const state = reactive({
{ {
label: '种植产物', label: '种植产物',
prop: 'crop', prop: 'crop',
width: '240px', editDisabled: false,
editDisabled: true,
showOverflowTooltip: true, showOverflowTooltip: true,
rules: { rules: {
required: true, required: true,
@ -158,11 +135,11 @@ const state = reactive({
}, },
{ {
label: '种植时间', label: '种植时间',
prop: 'operationDate', prop: 'planDate',
type: 'date', type: 'date',
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
width: 200, width: 160,
rules: { rules: {
required: true, required: true,
message: '请选择作业日期', message: '请选择作业日期',
@ -188,6 +165,15 @@ const state = reactive({
icon: 'edit', icon: 'edit',
event: ({ row }) => rowEdit(row), event: ({ row }) => rowEdit(row),
}, },
{
name: ({ row }) => {
return row.status == 1 ? '禁用' : '启用';
},
icon: ({ row }) => {
return row.status == 1 ? 'Close' : 'Check';
},
event: ({ row }) => rowStatus(row),
},
], ],
}, },
pageData: { pageData: {
@ -263,26 +249,26 @@ const stageState = reactive({
// //
const loadData = () => { const loadData = () => {
// state.loading = true; state.loading = true;
// getOperationRecord(state.query) getPlanType(state.query)
// .then((res) => { .then((res) => {
// if (res.code === 200) { if (res.code === 200) {
// const { current, size, total, records } = res.data; const { current, size, total, records } = res.data;
// state.data = records; state.data = records;
// state.pageData = { state.pageData = {
// currentPage: current || 1, currentPage: current || 1,
// pageSize: size || 10, pageSize: size || 10,
// total: total, total: total,
// }; };
// } }
// }) })
// .catch((err) => { .catch((err) => {
// app.$message.error(err.msg); app.$message.error(err.msg);
// state.data = []; state.data = [];
// }) })
// .finally(() => { .finally(() => {
// state.loading = false; state.loading = false;
// }); });
}; };
loadData(); loadData();
@ -320,8 +306,12 @@ const selectionChange = (rows) => {
// //
const rowSave = (row, done, loading) => { const rowSave = (row, done, loading) => {
// console.info('', row); console.info('新增', row);
saveOperationRecord(row) let parmer = {
planDate: row.planDate || '',
crop: row.crop || '',
};
savePlanType(parmer)
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
app.$message.success('添加成功!'); app.$message.success('添加成功!');
@ -349,39 +339,39 @@ const onExport = () => {
app.$message.error('当前暂时没有可供导出的数据!'); app.$message.error('当前暂时没有可供导出的数据!');
return; return;
} }
// state.loading = true; state.loading = true;
const fileName = '土地巡查明细表'; const fileName = '种植产物明细表';
// exportOperationRecord(state.query) exportPlanType(state.query)
// .then((res) => { .then((res) => {
// if (res.status === 200) { if (res.status === 200) {
// downloadFile(res.data, `${fileName}.xlsx`, 'blob'); downloadFile(res.data, `${fileName}.xlsx`, 'blob');
// app.$message.success(''); app.$message.success('导出成功!');
// } }
// }) })
// .catch((err) => { .catch((err) => {
// app.$message.error(''); app.$message.error('导出失败!');
// }) })
// .finally(() => { .finally(() => {
// state.loading = false; state.loading = false;
// }); });
}; };
const rowUpdate = (row, index, done, loading) => { const rowUpdate = (row, index, done, loading) => {
console.info('更新'); console.info('更新');
// editOperationRecord(row) upPlanType(row)
// .then((res) => { .then((res) => {
// if (res.code === 200) { if (res.code === 200) {
// app.$message.success(''); app.$message.success('更新成功!');
// done(); done();
// loadData(); loadData();
// } }
// }) })
// .catch((err) => { .catch((err) => {
// app.$message.error(err.msg); app.$message.error(err.msg);
// }) })
// .finally(() => { .finally(() => {
// loading(); loading();
// }); });
}; };
// //
@ -391,6 +381,25 @@ const stageRefresh = () => {
app.$message.success('刷新成功'); app.$message.success('刷新成功');
}; };
const rowStatus = (row) => {
console.info('操作状态');
let parmer = {
...row,
status: row.status == 1 ? 0 : 1,
};
upPlanType(parmer)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
};
const rowClick = (row) => { const rowClick = (row) => {
state.currentRow = { ...row }; state.currentRow = { ...row };
console.info('rowClick', state.currentRow); console.info('rowClick', state.currentRow);

View File

@ -3,7 +3,13 @@
<div> <div>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" /> <el-tree
style="max-width: 600px"
:data="typeTree"
node-key="areaCode"
:props="{ children: 'areaChildVOS', label: 'areaName' }"
@node-click="handleNodeClick"
/>
</el-col> </el-col>
<el-col :span="18"> <el-col :span="18">
<avue-crud <avue-crud
@ -42,6 +48,7 @@ import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config'; import { CRUD_OPTIONS } from '@/config';
import CustomCard from '@/components/CustomCard.vue'; import CustomCard from '@/components/CustomCard.vue';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { getRegion } from '@/apis/index';
const { VITE_APP_BASE_API } = import.meta.env; const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp(); const app = useApp();
@ -119,31 +126,31 @@ const state = reactive({
currentRow: {}, currentRow: {},
}); });
let typeTree = reactive([ let typeTree = ref([
{ // {
label: '耿马县', // label: '',
id: '0', // id: '0',
level: '0', // level: '0',
children: [ // children: [
{ // {
label: '镇1', // label: '1',
level: '1', // level: '1',
id: '01', // id: '01',
children: [ // children: [
{ label: '村1', children: [], id: '0101', pId: '01', level: '2' }, // { label: '1', children: [], id: '0101', pId: '01', level: '2' },
{ label: '村2', children: [], id: '0102', pId: '01', level: '2' }, // { label: '2', children: [], id: '0102', pId: '01', level: '2' },
], // ],
pId: '0', // pId: '0',
}, // },
{ label: '镇2', level: '1', children: [], id: '02', pId: '0' }, // { label: '2', level: '1', children: [], id: '02', pId: '0' },
], // ],
}, // },
{ // {
label: '县1', // label: '1',
id: '1', // id: '1',
level: '0', // level: '0',
children: [{ label: '镇1', children: [], id: '11', pId: '10', level: '1' }], // children: [{ label: '1', children: [], id: '11', pId: '10', level: '1' }],
}, // },
]); ]);
let townOptions = reactive([]); let townOptions = reactive([]);
@ -179,7 +186,18 @@ const loadData = () => {
// }); // });
}; };
const getTree = () => {
getRegion().then((res) => {
if (res.code === 200) {
const { code, data } = res;
typeTree.value = data;
console.info('区域信息', typeTree.value);
}
});
};
onMounted(() => { onMounted(() => {
getTree();
loadData(); loadData();
}); });
@ -215,25 +233,23 @@ const selectionChange = (rows) => {
}; };
const handleNodeClick = (data) => { const handleNodeClick = (data) => {
if (data.level == '2') { // if (data.level == '2') {
return; // return;
} // }
// console.info('data', data); // if (data.level == '0') {
if (data.level == '0') { // infoData.countyId = data.id;
infoData.countyId = data.id; // infoData.townId = '';
infoData.townId = ''; // }
} // if (data.level == '1') {
if (data.level == '1') { // let countys =
let countys = // typeTree.filter((m) => {
typeTree.filter((m) => { // return m.id == data.pId;
return m.id == data.pId; // }) || [];
}) || []; // let town = countys[0] && countys[0].children ? countys[0].children : [];
// townOptions = town;
let town = countys[0] && countys[0].children ? countys[0].children : []; // infoData.townId = data.id;
townOptions = town; // infoData.countyId = data.pId;
infoData.townId = data.id; // }
infoData.countyId = data.pId;
}
// console.info('infoData', infoData); // console.info('infoData', infoData);
}; };
// //

View File

@ -418,26 +418,26 @@ const state = reactive({
// //
const loadData = () => { const loadData = () => {
state.loading = true; // state.loading = true;
getOperationRecord(state.query) // getOperationRecord(state.query)
.then((res) => { // .then((res) => {
if (res.code === 200) { // if (res.code === 200) {
const { current, size, total, records } = res.data; // const { current, size, total, records } = res.data;
state.data = records; // state.data = records;
state.pageData = { // state.pageData = {
currentPage: current || 1, // currentPage: current || 1,
pageSize: size || 10, // pageSize: size || 10,
total: total, // total: total,
}; // };
} // }
}) // })
.catch((err) => { // .catch((err) => {
app.$message.error(err.msg); // app.$message.error(err.msg);
state.data = []; // state.data = [];
}) // })
.finally(() => { // .finally(() => {
state.loading = false; // state.loading = false;
}); // });
}; };
loadData(); loadData();

View File

@ -0,0 +1,140 @@
<template>
<div ref="chartContainer" style="width: 600px; height: 400px"></div>
</template>
<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue';
import * as echarts from 'echarts';
import geoJsonData from '../components/530926geo.json'; //
const chartContainer = ref(null);
let chartInstance = null;
//
const initChart = () => {
//
chartInstance = echarts.init(chartContainer.value);
//
echarts.registerMap('gengma', geoJsonData); // 使'gengma'
//
const option = {
title: {
text: '耿马县地图散点图',
left: 'center',
},
tooltip: {
trigger: 'item',
formatter: function (params) {
if (params.seriesType === 'effectScatter') {
return `${params.name}: (${params.value[0]}, ${params.value[1]})`;
}
return params.name;
},
},
toolbox: {
show: true,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
dataView: { readOnly: false },
restore: {},
saveAsImage: {},
},
},
geo: {
map: 'gengma',
roam: true,
zoom: 1.2,
itemStyle: {
normal: {
areaColor: '#1f77b4', //
borderColor: '#000', //
},
emphasis: {
areaColor: '#ff7f0e', //
borderColor: '#fff', //
},
},
},
series: [
//
{
name: '镇边界',
type: 'map',
mapType: 'gengma',
roam: true,
zoom: 1.2,
itemStyle: {
normal: {
borderColor: '#000', //
borderWidth: 1, //
areaColor: 'transparent', //
},
emphasis: {
borderColor: '#fff',
borderWidth: 2,
},
},
},
//
{
name: '闪烁散点',
type: 'effectScatter', // 使 effectScatter
coordinateSystem: 'geo',
data: [
//
{
name: '孟定镇',
value: [99.081993, 23.554045, 100], // , ,
itemStyle: {
color: '#FF0000', //
},
},
{
name: '勐永镇',
value: [99.406653, 23.534142, 80], // , ,
itemStyle: {
color: '#00FF00', //
},
},
],
symbolSize: function (val) {
return val[2] ? val[2] / 10 : 10; //
},
label: {
formatter: '{b}',
position: 'right',
show: false,
},
rippleEffect: {
period: 4, //
scale: 3, //
brushType: 'stroke', // 'stroke' 'fill'
},
hoverAnimation: true,
},
],
};
//
chartInstance.setOption(option);
};
//
onMounted(() => {
initChart();
});
//
onBeforeUnmount(() => {
if (chartInstance) {
chartInstance.dispose();
}
});
</script>
<style scoped>
/* 可以根据需要添加样式 */
</style>

View File

@ -0,0 +1,12 @@
<template>
<div>
<mapSplashed></mapSplashed>
</div>
</template>
<script setup>
// import { reactive, ref } from 'vue';
// import { useApp } from '@/hooks';
import mapSplashed from '../home/components/mapSplashed.vue';
</script>
<style></style>