From 65c727efb912fcd3a130bb684609984e836fe2b4 Mon Sep 17 00:00:00 2001 From: ihzero Date: Thu, 23 Mar 2023 16:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9F=BA=E5=9C=B0=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.ts | 37 ++-- src/views/base/base-data/base.data.ts | 10 ++ src/views/base/city-data/DeviceDrawer.vue | 167 +++++++++++++++++- src/views/base/city-data/city.data.ts | 16 ++ src/views/visualization/components/Circle.vue | 6 +- 5 files changed, 217 insertions(+), 19 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index b9d57c50..31baac9d 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -113,7 +113,7 @@ export function getTreeData( condition = 0, isNull = true, ) { - let arr = [] + const arr = [] for (let i = 0; i < data.length; i++) { if (data[i][pidName] == pid) { @@ -139,14 +139,14 @@ export function getTreeData( // 获取近7的时间 export function getWeek() { - let toData = new Date(new Date().toLocaleDateString()).getTime() + const toData = new Date(new Date().toLocaleDateString()).getTime() //今天 - let todayStart = toData + const todayStart = toData //昨天 - let yesterdayStart = toData - 3600 * 24 * 1000 - let yesterdayEnd = yesterdayStart + 24 * 60 * 60 * 1000 - 1 + const yesterdayStart = toData - 3600 * 24 * 1000 + const yesterdayEnd = yesterdayStart + 24 * 60 * 60 * 1000 - 1 //最近7天 - let past7daysStart = todayStart - 7 * 3600 * 24 * 1000 + const past7daysStart = todayStart - 7 * 3600 * 24 * 1000 // const date = new Date() // const year = date.getFullYear() // const month = date.getMonth() @@ -164,12 +164,12 @@ export function getWeek() { // 获取近一月的数据 export function getMonth() { - let toData = new Date(new Date().toLocaleDateString()).getTime() + const toData = new Date(new Date().toLocaleDateString()).getTime() //昨天 - let yesterdayStart = toData - 3600 * 24 * 1000 - let yesterdayEnd = yesterdayStart + 24 * 60 * 60 * 1000 - 1 + const yesterdayStart = toData - 3600 * 24 * 1000 + const yesterdayEnd = yesterdayStart + 24 * 60 * 60 * 1000 - 1 //最近30天 - let past30daysStart = toData - 30 * 3600 * 24 * 1000 + const past30daysStart = toData - 30 * 3600 * 24 * 1000 // const date = new Date() // const year = date.getFullYear() // const month = date.getMonth() @@ -198,3 +198,20 @@ export function jsonString(value) { } return false } + +// 加法函数(精度丢失问题) +export function accAdd(arg1, arg2) { + let r1, r2, m + try { + r1 = arg1.toString().split('.')[1].length + } catch (e) { + r1 = 0 + } + try { + r2 = arg2.toString().split('.')[1].length + } catch (e) { + r2 = 0 + } + m = Math.pow(10, Math.max(r1, r2)) + return (arg1 * m + arg2 * m) / m +} diff --git a/src/views/base/base-data/base.data.ts b/src/views/base/base-data/base.data.ts index 04d60a76..0ee0aa3e 100644 --- a/src/views/base/base-data/base.data.ts +++ b/src/views/base/base-data/base.data.ts @@ -34,6 +34,10 @@ export const columns: BasicColumn[] = [ title: '基地面积', dataIndex: 'areas', }, + { + title: '种养殖面积', + dataIndex: 'cultivated', + }, { title: '基地就业人数', dataIndex: 'workforce', @@ -101,6 +105,12 @@ export const accountFormSchema: FormSchema[] = [ required: true, component: 'Input', }, + { + field: 'cultivated', + label: '种养殖面积', + required: true, + component: 'Input', + }, { field: 'workforce', label: '基地人数', diff --git a/src/views/base/city-data/DeviceDrawer.vue b/src/views/base/city-data/DeviceDrawer.vue index 2559d683..ed4e9e55 100644 --- a/src/views/base/city-data/DeviceDrawer.vue +++ b/src/views/base/city-data/DeviceDrawer.vue @@ -4,23 +4,112 @@ @register="registerDrawer" showFooter :title="getTitle" - width="500px" + width="600px" @ok="handleSubmit" > - + + + diff --git a/src/views/base/city-data/city.data.ts b/src/views/base/city-data/city.data.ts index 4354bc8b..b3d3b5ff 100644 --- a/src/views/base/city-data/city.data.ts +++ b/src/views/base/city-data/city.data.ts @@ -26,6 +26,10 @@ export const columns: BasicColumn[] = [ title: '街镇面积', dataIndex: 'areas', }, + { + title: '耕地面积', + dataIndex: 'cultivated', + }, { title: '街镇人数', dataIndex: 'workforce', @@ -88,6 +92,12 @@ export const accountFormSchema: FormSchema[] = [ required: true, component: 'Input', }, + { + field: 'cultivated', + label: '耕地面积', + required: true, + component: 'Input', + }, { field: 'workforce', label: '街镇人数', @@ -132,6 +142,12 @@ export const accountFormSchema: FormSchema[] = [ required: false, component: 'InputTextArea', }, + { + field: 'extends', + label: '', + component: 'Input', + slot: 'extends', + }, ] export const searchFormSchema1: FormSchema[] = [ { diff --git a/src/views/visualization/components/Circle.vue b/src/views/visualization/components/Circle.vue index 0ec33d83..cee6483f 100644 --- a/src/views/visualization/components/Circle.vue +++ b/src/views/visualization/components/Circle.vue @@ -42,8 +42,8 @@