diff --git a/main/src/components/custom-echart-bar/index.vue b/main/src/components/custom-echart-bar/index.vue index 8945969..8592346 100644 --- a/main/src/components/custom-echart-bar/index.vue +++ b/main/src/components/custom-echart-bar/index.vue @@ -5,18 +5,22 @@ import { ref, reactive, watchEffect } from 'vue'; import { cloneDeep } from 'lodash'; import { useEcharts } from '../../hooks/useEcharts'; - export default { name: 'CustomEchartBar', props: { chartData: { type: Array, default: () => [], + required: true, }, option: { type: Object, default: () => ({}), }, + type: { + type: String, + default: 'bar', + }, width: { type: String, default: '100%', @@ -25,14 +29,11 @@ export default { type: String, default: 'calc(100vh - 78px)', }, - seriesColor: { - type: String, - default: '#1890ff', - }, }, - setup(props) { + emits: ['click'], + setup(props, { emit }) { const chartRef = ref(null); - const { setOptions } = useEcharts(chartRef); + const { setOptions, getInstance } = useEcharts(chartRef); const option = reactive({ tooltip: { trigger: 'axis', @@ -44,6 +45,12 @@ export default { }, }, }, + legend: { + top: 30, + }, + grid: { + top: 60, + }, xAxis: { type: 'category', data: [], @@ -51,14 +58,7 @@ export default { yAxis: { type: 'value', }, - series: [ - { - name: 'bar', - type: 'bar', - data: [], - color: props.seriesColor, - }, - ], + series: [], }); watchEffect(() => { @@ -69,16 +69,36 @@ export default { if (props.option) { Object.assign(option, cloneDeep(props.option)); } - let seriesData = props.chartData.map((item) => { - return item.value; + let typeArr = Array.from(new Set(props.chartData.map((item) => item.type))); + let xAxisData = Array.from(new Set(props.chartData.map((item) => item.name))); + let seriesData = []; + typeArr.forEach((type, index) => { + const barStyle = props.option?.barStyle ?? {}; + let obj = { name: type, type: props.type, ...barStyle }; + let data = []; + xAxisData.forEach((x) => { + let dataArr = props.chartData.filter((item) => type === item.type && item.name == x); + if (dataArr && dataArr.length > 0) { + data.push(dataArr[0].value); + } else { + data.push(null); + } + }); + obj['data'] = data; + if (props.option?.color) { + obj.color = props.option?.color[index]; + } + seriesData.push(obj); }); - let xAxisData = props.chartData.map((item) => { - return item.name; - }); - option.series[0].data = seriesData; - option.series[0].color = props.seriesColor; + option.series = seriesData; option.xAxis.data = xAxisData; setOptions(option); + getInstance()?.off('click', onClick); + getInstance()?.on('click', onClick); + } + + function onClick(params) { + emit('click', params); } return { chartRef }; }, diff --git a/main/src/components/custom-echart-multi-line/index.vue b/main/src/components/custom-echart-line/index.vue similarity index 99% rename from main/src/components/custom-echart-multi-line/index.vue rename to main/src/components/custom-echart-line/index.vue index 6029f70..00d47fd 100644 --- a/main/src/components/custom-echart-multi-line/index.vue +++ b/main/src/components/custom-echart-line/index.vue @@ -7,7 +7,7 @@ import { cloneDeep } from 'lodash'; import { useEcharts } from '../../hooks/useEcharts'; export default { - name: 'CustomEchartMultiLine', + name: 'CustomEchartLine', props: { chartData: { type: Array, diff --git a/main/src/components/custom-echart-mixin/index.vue b/main/src/components/custom-echart-mixin/index.vue new file mode 100644 index 0000000..1d00039 --- /dev/null +++ b/main/src/components/custom-echart-mixin/index.vue @@ -0,0 +1,85 @@ + + + diff --git a/main/src/components/index.js b/main/src/components/index.js index b2b5fc8..b95d513 100644 --- a/main/src/components/index.js +++ b/main/src/components/index.js @@ -4,6 +4,7 @@ import CustomImportExcel from './custom-import-excel'; import CustomRichEditor from './custom-rich-editor'; import CustomEchartBar from './custom-echart-bar'; import CustomEchartPie from './custom-echart-pie'; -import CustomEchartMultiLine from './custom-echart-multi-line'; +import CustomEchartLine from './custom-echart-line'; +import CustomEchartMixin from './custom-echart-mixin'; -export { SvgIcon, CustomTableOperate, CustomImportExcel, CustomRichEditor, CustomEchartBar, CustomEchartPie, CustomEchartMultiLine }; +export { SvgIcon, CustomTableOperate, CustomImportExcel, CustomRichEditor, CustomEchartBar, CustomEchartPie, CustomEchartLine, CustomEchartMixin }; diff --git a/sub-government-affairs-service/src/router/index.js b/sub-government-affairs-service/src/router/index.js index 6c70a9a..1b373f4 100644 --- a/sub-government-affairs-service/src/router/index.js +++ b/sub-government-affairs-service/src/router/index.js @@ -3,7 +3,7 @@ * @Author: zenghua.wang * @Date: 2023-06-20 11:48:41 * @LastEditors: zenghua.wang - * @LastEditTime: 2025-02-28 13:50:00 + * @LastEditTime: 2025-03-04 10:42:19 */ import { createRouter, createWebHistory } from 'vue-router'; import Layout from '@/layouts/index.vue'; @@ -12,7 +12,7 @@ import resourceRouter from './modules/resource'; import plantingAndBreedingRouter from './modules/plantingAndBreeding'; import landsRoutes from './modules/lands'; import annualplanRoutes from './modules/annualplan'; -import statisticsRoutes from './modules/statistics'; +import statisticsRoutes from './modules/statisticAnalysis'; import dictRoutes from './modules/dict'; export const constantRoutes = [ diff --git a/sub-government-affairs-service/src/router/modules/statisticAnalysis.js b/sub-government-affairs-service/src/router/modules/statisticAnalysis.js new file mode 100644 index 0000000..764d159 --- /dev/null +++ b/sub-government-affairs-service/src/router/modules/statisticAnalysis.js @@ -0,0 +1,32 @@ +import Layout from '@/layouts/index.vue'; +import Views from '@/layouts/Views.vue'; + +export default [ + { + path: '/sub-government-affairs-service/analysis', + name: 'analysis', + component: Layout, + redirect: '/sub-government-affairs-service/analysis-land', + meta: { title: '统计分析', icon: 'icon-test' }, + children: [ + { + path: '/sub-government-affairs-service/analysis-land', + component: () => import('@/views/statisticAnalysis/land/index.vue'), + name: 'analysis-land', + meta: { title: '土地利用与规划分析', icon: 'Document' }, + }, + // { + // path: '/sub-government-affairs-service/analysis-agriculture', + // name: 'analysis-agriculture', + // component: () => import('@/views/statisticAnalysis/agriculture/index.vue'), + // meta: { title: '农业生产效率分析', icon: 'Document' }, + // }, + // { + // path: '/sub-government-affairs-service/analysis-environment', + // name: 'analysis-environment', + // component: () => import('@/views/statisticAnalysis/environment/index.vue'), + // meta: { title: '环境影响与经济效益分析', icon: 'Document' }, + // }, + ], + }, +]; diff --git a/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/FileUpload.vue b/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/FileUpload.vue new file mode 100644 index 0000000..a9a1953 --- /dev/null +++ b/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/FileUpload.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/Register.vue b/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/Register.vue index 8541333..cf69e61 100644 --- a/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/Register.vue +++ b/sub-government-affairs-service/src/views/landManage/component/illegalHandle/common/Register.vue @@ -1,5 +1,5 @@ - + diff --git a/sub-government-affairs-service/src/views/landManage/component/landsManage/common/CreateLand.vue b/sub-government-affairs-service/src/views/landManage/component/landsManage/common/CreateLand.vue deleted file mode 100644 index 65a4dfd..0000000 --- a/sub-government-affairs-service/src/views/landManage/component/landsManage/common/CreateLand.vue +++ /dev/null @@ -1,284 +0,0 @@ - - - - - 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 a7e3d12..f23ac9c 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 @@ -13,6 +13,7 @@ :data="data" :option="option" :before-close="handleCloseFrom" + :table-loading="loading" @current-change="handlePageChange" @size-change="handleSizeChange" @search-reset="handleResetSearch" @@ -61,9 +62,7 @@ import { useUserStore } from '@/store/modules/user'; import { getLandsList, exportLands, delLand, saveLand, importLands } from '@/apis/land.js'; import { ElMessage } from 'element-plus'; import useLandHook from './useLandHook'; -import { CommonUpload } from '@/apis'; import Attrs from './common/Attrs.vue'; -import { add } from 'lodash'; const { landType, landsType, landClassificationType, handleIficationType } = useLandHook(); const { VITE_APP_BASE_API } = import.meta.env; @@ -79,8 +78,9 @@ const local_ = ref([102.833669, 24.88149, '昆明市']); const local = ref(JSON.parse(JSON.stringify(local_.value))); /* --------------- data --------------- */ // #region +const loading = ref(false); const crudRef = ref(); -const pageData = reactive({ +const pageData = ref({ currentPage: 1, pageSize: 10, total: 0, @@ -88,8 +88,8 @@ const pageData = reactive({ const data = ref([]); const option = reactive({ ...CRUD_OPTIONS, - selection: false, menuWidth: 120, + selection: false, column: [ { label: '地块名', @@ -375,30 +375,33 @@ const rowData = ref([]); // #region async function getList() { + loading.value = true; const params = { - current: pageData.currentPage, - size: pageData.pageSize, + current: pageData.value.currentPage, + size: pageData.value.pageSize, landType: landType.value, ...searchData, }; let res = await getLandsList(params); + loading.value = false; if (res.code == 200) { - data.value = res.data.records; + const { total, records } = res.data; + data.value = records; data.value.forEach((v) => { v.isTransfer = v.landTransfer || 1; v.isTransferView = v.landTransfer == 1 ? '否' : '是'; v.landClassificationTypeView = handleIficationType(v.handleIficationType); v.coordinateView = v.coordinate; }); - pageData.total = res.data.total; + pageData.value.total = total; } } function handlePageChange(val) { - pageData.currentPage = val; + pageData.value.currentPage = val; getList(); } function handleSizeChange(val) { - pageData.pageSize = val; + pageData.value.pageSize = val; getList(); } async function handleSearch(form, done) { @@ -412,9 +415,9 @@ async function handleResetSearch() { for (let key in searchData) { searchData[key] = ''; } - pageData.currentPage = 1; - pageData.pageSize = 10; - pageData.total = 0; + pageData.value.currentPage = 1; + pageData.value.pageSize = 10; + pageData.value.total = 0; await getList(); } const attrNames = reactive(landsType.map((v) => v.label)); diff --git a/sub-government-affairs-service/src/views/statisticAnalysis/land/index.vue b/sub-government-affairs-service/src/views/statisticAnalysis/land/index.vue new file mode 100644 index 0000000..13b17af --- /dev/null +++ b/sub-government-affairs-service/src/views/statisticAnalysis/land/index.vue @@ -0,0 +1,185 @@ + + + +