new-map
parent
33244082b5
commit
b3d711de7d
|
|
@ -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,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: '产量排行榜', //
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
@register="registerDrawer"
|
||||
showFooter
|
||||
:title="getTitle"
|
||||
width="500px"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<!-- <BasicForm @register="registerForm"> </BasicForm> -->
|
||||
<Form> </Form>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref, reactive } from 'vue'
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'
|
||||
import { Form } from 'ant-design-vue'
|
||||
const useForm = Form.useForm
|
||||
const modelRef = reactive({
|
||||
category_id: '', //产业ID
|
||||
name: '', //名称
|
||||
parent_id: '', //上级
|
||||
unit: '', //单位
|
||||
is_end: '', //是否是结点
|
||||
extends: [],
|
||||
sort: '', //排序
|
||||
})
|
||||
const rulesRef = reactive({
|
||||
category_id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
},
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入',
|
||||
},
|
||||
],
|
||||
unit: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入',
|
||||
},
|
||||
],
|
||||
sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入',
|
||||
},
|
||||
],
|
||||
})
|
||||
const { resetFields, validate, validateInfos } = useForm(modelRef, rulesRef)
|
||||
|
||||
// import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
// import { accountFormSchema } from './town.data'
|
||||
|
||||
// import { addcrops, editGriculturalBasic } from '/@/api/sys/user'
|
||||
|
||||
const emits = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(false)
|
||||
const getTitle = computed(() => (!isUpdate.value ? '新增农作物' : '编辑农作物'))
|
||||
// const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
// labelWidth: 90,
|
||||
// baseColProps: { span: 24 },
|
||||
// schemas: accountFormSchema,
|
||||
// showActionButtonGroup: false,
|
||||
// })
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
// resetFields()
|
||||
setDrawerProps({ confirmLoading: false })
|
||||
isUpdate.value = data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
// setFieldsValue({
|
||||
// ...data,
|
||||
// crops_ids: data.crops.map((e) => e.id),
|
||||
// })
|
||||
}
|
||||
})
|
||||
|
||||
const handleSubmit = async () => {
|
||||
// try {
|
||||
// const values = await validate()
|
||||
// values.crop_type = 2
|
||||
// values.is_end = values?.is_end ?? false
|
||||
// const params = {
|
||||
// ...values,
|
||||
// extends: {
|
||||
// name: '',
|
||||
// unit: '',
|
||||
// },
|
||||
// }
|
||||
// if (values.is_end) {
|
||||
// params.extends.name = values.endName
|
||||
// params.extends.unit = values.endUnit
|
||||
// } else {
|
||||
// delete params.extends
|
||||
// }
|
||||
// console.log(params)
|
||||
// setDrawerProps({ confirmLoading: true })
|
||||
// if (values.id) {
|
||||
// // 修改
|
||||
// await editGriculturalBasic(values.id, values)
|
||||
// } else {
|
||||
// // 新增
|
||||
// await addcrops(params)
|
||||
// }
|
||||
// closeDrawer()
|
||||
// emits('success')
|
||||
// } finally {
|
||||
// setDrawerProps({ confirmLoading: false })
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<template>
|
||||
<div class="pt-20px">
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" @click="handleCreate"> 新增农作物 </a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex items-center justify-center">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
placement: 'topRight',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'crops'">
|
||||
<Button
|
||||
class="mx-2px"
|
||||
v-for="(item, index) in record['crops']"
|
||||
:key="index"
|
||||
type="link"
|
||||
>{{ item.name }}</Button
|
||||
>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<TownDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
||||
import { deleteGriculturalBasic, getTownAgriculturalBasic } from '/@/api/sys/user'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useDrawer } from '/@/components/Drawer'
|
||||
import TownDrawer from './TownDrawer.vue'
|
||||
import { Button } from 'ant-design-vue'
|
||||
import { columns, searchFormSchema } from './town.data'
|
||||
const [registerDrawer, { openDrawer }] = useDrawer()
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '农作物列表',
|
||||
api: async (e) => {
|
||||
const res = await getTownAgriculturalBasic({ type: 1, ...e })
|
||||
return res
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
useSearchForm: false,
|
||||
showTableSetting: true,
|
||||
bordered: true,
|
||||
showIndexColumn: true,
|
||||
})
|
||||
|
||||
const handleSuccess = () => {
|
||||
message.success('操作成功')
|
||||
reload()
|
||||
}
|
||||
const handleCreate = () => {
|
||||
openDrawer(true, {
|
||||
isUpdate: false,
|
||||
})
|
||||
}
|
||||
const handleEdit = (record: Recordable) => {
|
||||
openDrawer(true, {
|
||||
...record,
|
||||
isUpdate: true,
|
||||
})
|
||||
}
|
||||
const handleDelete = async (record: Recordable) => {
|
||||
await deleteGriculturalBasic(record.id)
|
||||
message.success('删除成功')
|
||||
reload()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -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
|
||||
},
|
||||
},
|
||||
]
|
||||
Loading…
Reference in New Issue