From 320ea1724d4a48d7e55e30658449f7654e2b8d03 Mon Sep 17 00:00:00 2001 From: H <30830569@qq.com> Date: Thu, 3 Nov 2022 17:45:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E5=86=99=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/api/sys/user.ts | 98 ++++++++ src/router/routes/modules/base.ts | 24 +- src/utils/index.ts | 10 + src/views/base/base-data/BaseDrawer.vue | 77 ++++++ src/views/base/base-data/base.data.ts | 132 +++++++++++ src/views/base/base-data/index.vue | 86 +++++++ src/views/base/base-data/map.vue | 115 +++++++++ src/views/base/city-data/DeviceDrawer.vue | 55 +++++ src/views/base/city-data/city.data.ts | 127 ++++++++++ .../base/city-data/components/CountItem.vue | 8 +- src/views/base/city-data/index.vue | 162 +++++++------ .../industrial-structure/components/Chart.vue | 18 +- src/views/base/ranking-list/RankingDrawer.vue | 80 +++++++ src/views/base/ranking-list/index.vue | 222 ++++++------------ src/views/base/ranking-list/index1.vue | 160 +++++++++++++ src/views/base/ranking-list/ranking.data.ts | 175 ++++++++++++++ yarn.lock | 5 + 18 files changed, 1307 insertions(+), 248 deletions(-) create mode 100644 src/views/base/base-data/BaseDrawer.vue create mode 100644 src/views/base/base-data/base.data.ts create mode 100644 src/views/base/base-data/index.vue create mode 100644 src/views/base/base-data/map.vue create mode 100644 src/views/base/city-data/DeviceDrawer.vue create mode 100644 src/views/base/city-data/city.data.ts create mode 100644 src/views/base/ranking-list/RankingDrawer.vue create mode 100644 src/views/base/ranking-list/index1.vue create mode 100644 src/views/base/ranking-list/ranking.data.ts diff --git a/package.json b/package.json index 119ec238..9c8a108a 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "gen:icon": "esno ./build/generate/icon/index.ts" }, "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1", "@ant-design/colors": "^6.0.0", "@ant-design/icons-vue": "^6.1.0", "@iconify/iconify": "^2.2.1", diff --git a/src/api/sys/user.ts b/src/api/sys/user.ts index e4d62080..aaed733e 100644 --- a/src/api/sys/user.ts +++ b/src/api/sys/user.ts @@ -149,6 +149,20 @@ export function getAgriculturalBasic(mode: ErrorMessageMode = 'modal') { }, ) } +/** + * @description:镇街数据 + */ +export function getTownAgriculturalBasic(params, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: '/api/agricultural-basic', + params, + }, + { + errorMessageMode: mode, + }, + ) +} /** * @description:新增管理员 */ @@ -230,3 +244,87 @@ export function editPassword(id: string, data, mode: ErrorMessageMode = 'modal') }, ) } + +/** + * @description:获取农作物 + */ +export function getCrops(data, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: `/api/crops`, + data, + }, + { + errorMessageMode: mode, + }, + ) +} + +/** + * @description:新增区域数据 + */ +export function addaGriculturalBasic(data, mode: ErrorMessageMode = 'modal') { + return defHttp.post( + { + url: `/api/agricultural-basic`, + data, + }, + { + errorMessageMode: mode, + }, + ) +} +/** + * @description:修改区域数据 + */ +export function editGriculturalBasic(id: string, data, mode: ErrorMessageMode = 'modal') { + return defHttp.put( + { + url: `/api/agricultural-basic/${id}`, + data, + }, + { + errorMessageMode: mode, + }, + ) +} +/** + * @description:删除区域数据 + */ +export function deleteGriculturalBasic(id: string, mode: ErrorMessageMode = 'modal') { + return defHttp.delete( + { + url: `/api/agricultural-basic/${id}`, + }, + { + errorMessageMode: mode, + }, + ) +} +/** + * @description:详情区域数据 + */ +export function GriculturalBasicInfo(id: string, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: `/api/agricultural-basic/${id}`, + }, + { + errorMessageMode: mode, + }, + ) +} +/** + * @description:查看农作物产量 + */ +export function getCropYields(params, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: `/api/crop-yields`, + params, + }, + { + errorMessageMode: mode, + }, + ) +} diff --git a/src/router/routes/modules/base.ts b/src/router/routes/modules/base.ts index 11324a25..d62463f9 100644 --- a/src/router/routes/modules/base.ts +++ b/src/router/routes/modules/base.ts @@ -1,5 +1,5 @@ -import type { AppRouteModule } from '/@/router/types'; -import { LAYOUT } from '/@/router/constant'; +import type { AppRouteModule } from '/@/router/types' +import { LAYOUT } from '/@/router/constant' const main: AppRouteModule = { path: '/base', name: 'Base', @@ -20,13 +20,21 @@ const main: AppRouteModule = { }, }, { - path: 'industrial-structure', - name: 'BaseIndustrialStructure', - component: () => import('/@/views/base/industrial-structure/index.vue'), + path: 'base-data', + name: 'BaseData', + component: () => import('/@/views/base/base-data/index.vue'), meta: { - title: '农业产业结构', + title: '全市基地数据', }, }, + // { + // path: 'industrial-structure', + // name: 'BaseIndustrialStructure', + // component: () => import('/@/views/base/industrial-structure/index.vue'), + // meta: { + // title: '农业产业结构', + // }, + // }, { path: 'ranking-list', name: 'BaseRankingList', @@ -52,6 +60,6 @@ const main: AppRouteModule = { }, }, ], -}; +} -export default main; +export default main diff --git a/src/utils/index.ts b/src/utils/index.ts index a887d173..f7ee8394 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -90,3 +90,13 @@ export const withInstall = (component: T, alias?: string) => { } return component as T & Plugin } +export function formatDataByObject(obj) { + const arr: any[] = [] + Object.keys(obj).forEach((e) => { + arr.push({ + label: obj[e], + value: e, + }) + }) + return arr +} diff --git a/src/views/base/base-data/BaseDrawer.vue b/src/views/base/base-data/BaseDrawer.vue new file mode 100644 index 00000000..4ec415eb --- /dev/null +++ b/src/views/base/base-data/BaseDrawer.vue @@ -0,0 +1,77 @@ + + diff --git a/src/views/base/base-data/base.data.ts b/src/views/base/base-data/base.data.ts new file mode 100644 index 00000000..efdd56a2 --- /dev/null +++ b/src/views/base/base-data/base.data.ts @@ -0,0 +1,132 @@ +import { BasicColumn } from '/@/components/Table' +import { FormSchema } from '/@/components/Table' +import { getCrops } from '/@/api/sys/user' +export const columns: BasicColumn[] = [ + { + title: '基地名称', + dataIndex: 'name', + }, + { + title: '基地负责人', + dataIndex: 'person', + }, + { + title: '基地农作物', + dataIndex: 'crops', + }, + { + title: '基地经度', + dataIndex: 'address_lat', + }, + { + title: '基地纬度', + dataIndex: 'address_lng', + }, + { + title: '基地地址', + dataIndex: 'address', + }, + { + title: '基地面积', + dataIndex: 'areas', + }, + { + title: '基地就业人数', + dataIndex: 'workforce', + }, + { + title: '基地描述', + dataIndex: 'description', + }, + { + width: 180, + title: '操作', + dataIndex: 'action', + align: 'center', + fixed: undefined, + }, +] + +export const searchFormSchema: FormSchema[] = [] + +export const accountFormSchema: FormSchema[] = [ + { + field: 'id', + label: '基地ID', + required: false, + dynamicDisabled: true, + component: 'Input', + ifShow: ({ values }) => { + return !!values.id + }, + }, + { + field: 'name', + label: '基地名称', + required: true, + component: 'Input', + }, + { + field: 'address', + label: '基地地址', + required: true, + component: 'Input', + }, + { + field: 'person', + label: '基地负责人', + required: true, + component: 'Input', + }, + { + field: 'areas', + label: '基地面积', + required: true, + component: 'Input', + }, + { + field: 'workforce', + label: '基地人数', + required: true, + component: 'Input', + }, + { + field: 'crops_ids', + label: '基地农作物', + required: true, + component: 'ApiSelect', + componentProps: { + api: async () => { + const res = await getCrops({ type: 'all', crop_type: 1 }) + return res.map((e) => { + return { + ...e, + disabled: e.is_end === 1, + } + }) + }, + labelField: 'name', + valueField: 'id', + mode: 'multiple', + }, + }, + + { + field: 'description', + label: '基地介绍', + required: false, + component: 'InputTextArea', + }, + { + field: 'address_lat', + label: '基地经度', + required: false, + component: 'Input', + }, + { + field: 'address_lng', + label: '基地纬度', + required: false, + component: 'Input', + }, +] diff --git a/src/views/base/base-data/index.vue b/src/views/base/base-data/index.vue new file mode 100644 index 00000000..f2d65c92 --- /dev/null +++ b/src/views/base/base-data/index.vue @@ -0,0 +1,86 @@ + + diff --git a/src/views/base/base-data/map.vue b/src/views/base/base-data/map.vue new file mode 100644 index 00000000..96927378 --- /dev/null +++ b/src/views/base/base-data/map.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/views/base/city-data/DeviceDrawer.vue b/src/views/base/city-data/DeviceDrawer.vue new file mode 100644 index 00000000..2559d683 --- /dev/null +++ b/src/views/base/city-data/DeviceDrawer.vue @@ -0,0 +1,55 @@ + + diff --git a/src/views/base/city-data/city.data.ts b/src/views/base/city-data/city.data.ts new file mode 100644 index 00000000..29c0285a --- /dev/null +++ b/src/views/base/city-data/city.data.ts @@ -0,0 +1,127 @@ +import { BasicColumn } from '/@/components/Table' +import { FormSchema } from '/@/components/Table' +// import { getCrops } from '/@/api/sys/user' +export const columns: BasicColumn[] = [ + { + title: '街镇名称', + dataIndex: 'name', + }, + // { + // title: '农作物', + // dataIndex: 'cultivated', + // }, + // { + // title: '街镇经度', + // dataIndex: 'address_lat', + // }, + // { + // title: '街镇纬度', + // dataIndex: 'address_lng', + // }, + { + title: '街镇地址', + dataIndex: 'address', + }, + { + title: '街镇面积', + dataIndex: 'areas', + }, + { + title: '街镇就业人数', + dataIndex: 'workforce', + }, + { + title: '街镇描述', + dataIndex: 'description', + }, + { + width: 180, + title: '操作', + dataIndex: 'action', + align: 'center', + fixed: undefined, + }, +] + +export const searchFormSchema: FormSchema[] = [] + +export const accountFormSchema: FormSchema[] = [ + { + field: 'id', + label: '街镇ID', + required: false, + dynamicDisabled: true, + component: 'Input', + ifShow: ({ values }) => { + return !!values.id + }, + }, + { + field: 'name', + label: '街镇名称', + required: true, + component: 'Input', + }, + { + field: 'address', + label: '街镇地址', + required: true, + component: 'Input', + }, + // { + // field: 'person', + // label: '街镇负责人', + // required: true, + // component: 'Input', + // }, + { + field: 'areas', + label: '街镇面积', + required: true, + component: 'Input', + }, + { + field: 'workforce', + label: '街镇人数', + required: true, + component: 'Input', + }, + // { + // field: 'crops_ids', + // label: '街镇农作物', + // required: true, + // component: 'ApiSelect', + // componentProps: { + // api: async () => { + // const res = await getCrops({ type: 'all', crop_type: 2 }) + // return res.map((e) => { + // return { + // ...e, + // disabled: e.is_end === 1, + // } + // }) + // }, + // labelField: 'name', + // valueField: 'id', + // mode: 'multiple', + // }, + // }, + // { + // field: 'address_lat', + // label: '街镇经度', + // required: false, + // component: 'Input', + // }, + // { + // field: 'address_lng', + // label: '街镇纬度', + // required: false, + // component: 'Input', + // }, + { + field: 'description', + label: '街镇介绍', + required: false, + component: 'InputTextArea', + }, +] diff --git a/src/views/base/city-data/components/CountItem.vue b/src/views/base/city-data/components/CountItem.vue index 7199541c..3b9df5bb 100644 --- a/src/views/base/city-data/components/CountItem.vue +++ b/src/views/base/city-data/components/CountItem.vue @@ -1,8 +1,8 @@ diff --git a/src/views/base/city-data/index.vue b/src/views/base/city-data/index.vue index 48720946..c69de45e 100644 --- a/src/views/base/city-data/index.vue +++ b/src/views/base/city-data/index.vue @@ -1,78 +1,60 @@ diff --git a/src/views/base/ranking-list/RankingDrawer.vue b/src/views/base/ranking-list/RankingDrawer.vue new file mode 100644 index 00000000..a5d05986 --- /dev/null +++ b/src/views/base/ranking-list/RankingDrawer.vue @@ -0,0 +1,80 @@ + + diff --git a/src/views/base/ranking-list/index.vue b/src/views/base/ranking-list/index.vue index 0d073eda..f570cddc 100644 --- a/src/views/base/ranking-list/index.vue +++ b/src/views/base/ranking-list/index.vue @@ -1,160 +1,78 @@