From b3d711de7d03d5d2c598c2d4f8bf52f6b2a425a3 Mon Sep 17 00:00:00 2001
From: H <30830569@qq.com>
Date: Mon, 7 Nov 2022 09:37:09 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/sys/user.ts | 34 ++++-
src/router/routes/modules/base.ts | 122 ++++++++++++++--
.../base/crops/town-crops/TownDrawer.vue | 115 +++++++++++++++
src/views/base/crops/town-crops/index.vue | 86 ++++++++++++
src/views/base/crops/town-crops/town.data.ts | 131 ++++++++++++++++++
5 files changed, 476 insertions(+), 12 deletions(-)
create mode 100644 src/views/base/crops/town-crops/TownDrawer.vue
create mode 100644 src/views/base/crops/town-crops/index.vue
create mode 100644 src/views/base/crops/town-crops/town.data.ts
diff --git a/src/api/sys/user.ts b/src/api/sys/user.ts
index aaed733e..12dd3039 100644
--- a/src/api/sys/user.ts
+++ b/src/api/sys/user.ts
@@ -314,13 +314,27 @@ export function GriculturalBasicInfo(id: string, mode: ErrorMessageMode = 'modal
},
)
}
+
/**
- * @description:查看农作物产量
+ * @description:农作物产业分类
*/
-export function getCropYields(params, mode: ErrorMessageMode = 'modal') {
+export function getCropCate(mode: ErrorMessageMode = 'modal') {
return defHttp.get(
{
- url: `/api/crop-yields`,
+ url: `/api/keywords-crops-cate`,
+ },
+ {
+ errorMessageMode: mode,
+ },
+ )
+}
+/**
+ * @description:农作物
+ */
+export function getcrops(params, mode: ErrorMessageMode = 'modal') {
+ return defHttp.get(
+ {
+ url: `/api/crops`,
params,
},
{
@@ -328,3 +342,17 @@ export function getCropYields(params, mode: ErrorMessageMode = 'modal') {
},
)
}
+/**
+ * @description:添加农作物
+ */
+export function addcrops(data, mode: ErrorMessageMode = 'modal') {
+ return defHttp.post(
+ {
+ url: `/api/crops`,
+ data,
+ },
+ {
+ errorMessageMode: mode,
+ },
+ )
+}
diff --git a/src/router/routes/modules/base.ts b/src/router/routes/modules/base.ts
index d62463f9..da9e4f46 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 { getParentLayout, LAYOUT } from '/@/router/constant'
const main: AppRouteModule = {
path: '/base',
name: 'Base',
@@ -12,20 +12,124 @@ const main: AppRouteModule = {
},
children: [
{
- path: 'city-data',
- name: 'BaseCityData',
- component: () => import('/@/views/base/city-data/index.vue'),
+ path: 'basics',
+ name: 'Basics',
meta: {
title: '全市基础数据',
+ // icon: 'ion:key-outline',
},
+ children: [
+ {
+ path: 'town-base',
+ name: 'TownBase',
+ component: () => import('/@/views/base/city-data/index.vue'),
+ meta: {
+ title: '城镇数据',
+ },
+ },
+ {
+ path: 'basics-base',
+ name: 'BasicsBase',
+ component: () => import('/@/views/base/base-data/index.vue'),
+ meta: {
+ title: '基地数据',
+ },
+ },
+ ],
},
{
- path: 'base-data',
- name: 'BaseData',
- component: () => import('/@/views/base/base-data/index.vue'),
+ path: 'crop',
+ name: 'Crop',
meta: {
- title: '全市基地数据',
+ title: '农作物数据',
+ // icon: 'ion:key-outline',
},
+ children: [
+ {
+ path: 'town-crop',
+ name: 'TownCrop',
+ component: () => import('/@/views/base/crops/town-crops/index.vue'),
+ meta: {
+ title: '城镇农作物',
+ },
+ },
+ {
+ path: 'basics-crop',
+ name: 'BasicsCrop',
+ component: () => import('/@/views/base/base-data/index.vue'),
+ meta: {
+ title: '基地农作物',
+ },
+ },
+ ],
+ },
+ {
+ path: 'yield',
+ name: 'Yield',
+ meta: {
+ title: '农作物产量',
+ // icon: 'ion:key-outline',
+ },
+ children: [
+ {
+ path: 'town-yield',
+ name: 'TownYield',
+ component: () => import('/@/views/base/city-data/index.vue'),
+ meta: {
+ title: '城镇产量',
+ },
+ },
+ {
+ path: 'basics-yield',
+ name: 'BasicsYield',
+ component: () => import('/@/views/base/base-data/index.vue'),
+ meta: {
+ title: '基地产量',
+ },
+ },
+ ],
+ },
+ {
+ path: 'industry',
+ name: 'Industry',
+ meta: {
+ title: '重点产业',
+ // icon: 'ion:key-outline',
+ },
+ children: [
+ {
+ path: 'industry-price',
+ name: 'IndustryPrice',
+ component: () => import('/@/views/base/city-data/index.vue'),
+ meta: {
+ title: '稻虾价格',
+ },
+ },
+ {
+ path: 'industry-industry',
+ name: 'IndustryIndustry',
+ component: () => import('/@/views/base/base-data/index.vue'),
+ meta: {
+ title: '稻虾产业',
+ },
+ },
+ {
+ path: 'basics-flow',
+ name: 'BasicsFlow',
+ component: () => import('/@/views/base/base-data/index.vue'),
+ meta: {
+ title: '稻虾流向',
+ },
+ },
+ {
+ path: 'basics-material',
+ name: 'BasicsMaterial',
+ component: () => import('/@/views/base/base-data/index.vue'),
+ meta: {
+ title: '大宗物资',
+ },
+ },
+ ],
},
// {
// path: 'industrial-structure',
@@ -40,7 +144,7 @@ const main: AppRouteModule = {
name: 'BaseRankingList',
component: () => import('/@/views/base/ranking-list/index.vue'),
meta: {
- title: '产量排行榜',
+ title: '产量排行榜', //
},
},
{
diff --git a/src/views/base/crops/town-crops/TownDrawer.vue b/src/views/base/crops/town-crops/TownDrawer.vue
new file mode 100644
index 00000000..5d04fc58
--- /dev/null
+++ b/src/views/base/crops/town-crops/TownDrawer.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
diff --git a/src/views/base/crops/town-crops/index.vue b/src/views/base/crops/town-crops/index.vue
new file mode 100644
index 00000000..25c8c63a
--- /dev/null
+++ b/src/views/base/crops/town-crops/index.vue
@@ -0,0 +1,86 @@
+
+
+
+
+ 新增农作物
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/base/crops/town-crops/town.data.ts b/src/views/base/crops/town-crops/town.data.ts
new file mode 100644
index 00000000..07e3e5e9
--- /dev/null
+++ b/src/views/base/crops/town-crops/town.data.ts
@@ -0,0 +1,131 @@
+import { BasicColumn } from '/@/components/Table'
+import { FormSchema } from '/@/components/Table'
+import { getCropCate, 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: 'category_id',
+ label: '产业',
+ required: true,
+ component: 'ApiSelect',
+ componentProps: {
+ api: getCropCate,
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ field: 'name',
+ label: '名称',
+ required: true,
+ component: 'Input',
+ },
+ {
+ field: 'parent_id',
+ label: '上级',
+ required: false,
+ component: 'ApiSelect',
+ componentProps: {
+ api: async () => {
+ const res = await getcrops({ page: 1, per_page: 99999, crop_type: 2, type: 'all' })
+ return res.filter((e) => !e.is_end)
+ },
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ field: 'unit',
+ label: '单位',
+ required: true,
+ component: 'Input',
+ },
+ {
+ field: 'sort',
+ label: '排序',
+ required: true,
+ component: 'InputNumber',
+ },
+ {
+ field: 'is_end',
+ label: '是否是结点',
+ required: false,
+ component: 'Switch',
+ },
+ {
+ field: 'endName',
+ label: '名称',
+ required: true,
+ component: 'Input',
+ ifShow: ({ values }) => {
+ return values.is_end
+ },
+ },
+
+ {
+ field: 'endUnit',
+ label: '单位',
+ required: true,
+ component: 'Input',
+ ifShow: ({ values }) => {
+ return values.is_end
+ },
+ },
+]