diff --git a/src/store/modules/visualization.ts b/src/store/modules/visualization.ts
index 05d89588..200e9b15 100644
--- a/src/store/modules/visualization.ts
+++ b/src/store/modules/visualization.ts
@@ -10,7 +10,7 @@ interface VisualizationState {
export const useVisualizationStore = defineStore({
id: 'app-visualization',
state: (): VisualizationState => ({
- year: Number(localStorage.getItem(YEAR_KEY)) || new Date().getFullYear(),
+ year: Number(localStorage.getItem(YEAR_KEY)) || new Date().getFullYear() - 1,
addressId: null,
}),
getters: {
diff --git a/src/views/base/city-data/CensusDrawer.vue b/src/views/base/city-data/CensusDrawer.vue
index 0b536400..c371b221 100644
--- a/src/views/base/city-data/CensusDrawer.vue
+++ b/src/views/base/city-data/CensusDrawer.vue
@@ -4,25 +4,97 @@
@register="registerDrawer"
showFooter
title="编辑统计"
- width="500px"
+ width="600px"
@ok="handleSubmit"
>
-
-
-
+
+
+
+
+
+
+
+
@@ -32,8 +104,11 @@
import { BasicForm, useForm } from '/@/components/Form/index'
import { searchFormSchema1 } from './city.data'
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'
- import { Input, FormItem } from 'ant-design-vue'
+ import { Input, FormItem, Row, Col } from 'ant-design-vue'
import { citydataEdit } from '/@/api/sys/user'
+ import { concat } from 'lodash-es'
+ import { isObject } from '/@/utils/is'
+ import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'
const emits = defineEmits(['success', 'register'])
const isUpdate = ref(false)
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
@@ -42,19 +117,61 @@
schemas: searchFormSchema1,
showActionButtonGroup: false,
})
+
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
resetFields()
setDrawerProps({ confirmLoading: false })
isUpdate.value = data?.isUpdate
+
if (unref(isUpdate)) {
+ const tempData = data.data.reduce((pre, cur) => {
+ const obj = {
+ name: cur.name,
+ slug: cur.slug,
+ unit: cur.unit,
+ }
+ if (isObject(cur.value)) {
+ // cur.value[2023] = ''
+ const temp = []
+ // if(Object.keys(cur.value).length === 1))
+ if (Object.keys(cur.value).length === 0) {
+ temp.push({
+ value: '',
+ year: '',
+ })
+ }
+
+ for (const key in cur.value) {
+ temp.push({
+ value: cur.value[key],
+ year: key,
+ })
+ }
+ return concat(pre, {
+ ...obj,
+ isMore: true,
+ value: temp,
+ })
+ }
+ return concat(pre, {
+ ...obj,
+ isMore: false,
+ value: cur.value,
+ })
+ }, [])
+ console.log(tempData)
+
setFieldsValue({
- ...data,
+ data: tempData,
})
}
})
const handleSubmit = async () => {
try {
const { data } = await validate()
+ console.log(data)
+
+ return
const params = {}
data.forEach((e) => {
params[e.slug] = e.value
@@ -66,4 +183,15 @@
setDrawerProps({ confirmLoading: false })
}
}
+
+ const addDomain = (item) => {
+ item.value.push({
+ value: '',
+ year: '',
+ })
+ }
+
+ const removeDomain = (item, index) => {
+ item.value.splice(index, 1)
+ }
diff --git a/src/views/base/city-data/index.vue b/src/views/base/city-data/index.vue
index 7534543c..1abb05e8 100644
--- a/src/views/base/city-data/index.vue
+++ b/src/views/base/city-data/index.vue
@@ -5,6 +5,7 @@
编辑